I have problem with might be the dimension of the data, but I’m not sure of what.
python
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-15-15f27fbb6c3d> in <module>()
4 y = Variable(labels).cuda()
5
----> 6 y_pred = net(x)
7
8 loss = loss_fn(y_pred, y)
~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
355 result = self._slow_forward(*input, **kwargs)
356 else:
--> 357 result = self.forward(*input, **kwargs)
358 for hook in self._forward_hooks.values():
359 hook_result = hook(self, input, result)
<ipython-input-8-da9debe84dcb> in forward(self, x)
18
19 x = x.view(-1, self.num_flat_features(x))
---> 20 x = F.relu(self.fc1(x))
21 x = F.relu(self.fc2(x))
22 x = self.fc3(x)
~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
355 result = self._slow_forward(*input, **kwargs)
356 else:
--> 357 result = self.forward(*input, **kwargs)
358 for hook in self._forward_hooks.values():
359 hook_result = hook(self, input, result)
~/anaconda3/lib/python3.6/site-packages/torch/nn/modules/linear.py in forward(self, input)
53
54 def forward(self, input):
---> 55 return F.linear(input, self.weight, self.bias)
56
57 def __repr__(self):
~/anaconda3/lib/python3.6/site-packages/torch/nn/functional.py in linear(input, weight, bias)
833 if input.dim() == 2 and bias is not None:
834 # fused op is marginally faster
--> 835 return torch.addmm(bias, input, weight.t())
836
837 output = input.matmul(weight.t())
RuntimeError: size mismatch at /opt/conda/conda-bld/pytorch_1518244507981/work/torch/lib/THC/generic/THCTensorMathBlas.cu:247
the length of loaded_data=3739.