In the backward method, I am getting an error like this,:
Traceback (most recent call last):
File “./pytorch_run.py”, line 153, in
train()
File “./pytorch_run.py”, line 93, in train
loss.backward() # backprop
File “/usr/local/lib/python2.7/dist-packages/torch/autograd/variable.py”, line 167, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph, retain_variables)
File “/usr/local/lib/python2.7/dist-packages/torch/autograd/init.py”, line 99, in backward
variables, grad_variables, retain_graph)
RuntimeError: size is not implemented for type UndefinedType
But, the loss is a Tensor of type torch.FloatTensor.
The error was while registering the parameters like this
self.logvar_bn .register_parameter(‘weight’, None)
self.mean_bn .register_parameter(‘weight’, None)
self.decoder_bn.register_parameter(‘weight’, None)
self.decoder_bn.register_parameter(‘weight’, None)
in pytorch_model.py which was giving the errors.