I’m working on a DDPG implementation and getting `AttributeError: 'numpy.ndarray' object has no attribute 'dim'`

from my Actor class.

Based on answer here https://discuss.pytorch.org/t/attributeerror-numpy-ndarray-object-has-no-attribute-dim/16026/2, I tried using `Variable()`

, however, the args are Tensors already and I get the `TypeError: expected np.ndarray (got Tensor)`

error.

**Code**

```
def forward(self, state):
"""
Build the policy/actor network that maps states to actions.
Using Tanh activation as per DDPG paper
"""
# print(type(state)) # <class 'torch.Tensor'>
# state = Variable(T.from_numpy(state))
x = self.inp(state)
l1_states = F.relu(x)
l2_states = F.relu(self.h1(l1_states))
l3_actions = T.tanh(self.out(l2_states))
return l3_actions
```

**Error:**

```
<ipython-input-11-d3087ef19a20> in forward(self, state)
71 # print(type(state)) # <class 'torch.Tensor'>
72 # state = Variable(T.from_numpy(state))
---> 73 x = self.inp(state)
74 l1_states = F.relu(x)
75 l2_states = F.relu(self.h1(l1_states))
~/anaconda3/envs/drlnd/lib/python3.6/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
539 result = self._slow_forward(*input, **kwargs)
540 else:
--> 541 result = self.forward(*input, **kwargs)
542 for hook in self._forward_hooks.values():
543 hook_result = hook(self, input, result)
~/anaconda3/envs/drlnd/lib/python3.6/site-packages/torch/nn/modules/linear.py in forward(self, input)
85
86 def forward(self, input):
---> 87 return F.linear(input, self.weight, self.bias)
88
89 def extra_repr(self):
~/anaconda3/envs/drlnd/lib/python3.6/site-packages/torch/nn/functional.py in linear(input, weight, bias)
1366 - Output: :math:`(N, *, out\_features)`
1367 """
-> 1368 if input.dim() == 2 and bias is not None:
1369 # fused op is marginally faster
1370 ret = torch.addmm(bias, input, weight.t())
AttributeError: 'numpy.ndarray' object has no attribute 'dim'
```