pytorch-avitm icon indicating copy to clipboard operation
pytorch-avitm copied to clipboard

Error in the backward method

Open deepcode-debug opened this issue 7 years ago • 3 comments

Hi,

Can you please check 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

deepcode-debug avatar May 07 '18 15:05 deepcode-debug

The error is in the register parameter in pytorch_model.py Removing them the model works fine.

deepcode-debug avatar May 08 '18 11:05 deepcode-debug

What was the function of register parameter? Thanks.

erlebach avatar Dec 26 '18 04:12 erlebach

Hi @DeepInEvil i am also getting an Error

File "pytorch_run.py", line 162, in train() File "pytorch_run.py", line 101, in train loss.backward() # backprop File "/data/home/adeshadikane/ML/rcs/lib/python3.8/site-packages/torch/_tensor.py", line 487, in backward torch.autograd.backward( File "/data/home/adeshadikane/ML/rcs/lib/python3.8/site-packages/torch/autograd/init.py", line 200, in backward Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass RuntimeError: Function NativeBatchNormBackward0 returned an invalid gradient at index 2 - got [0] but expected shape compatible with [1995]

Could you please help me with it or can you send me the corrected code which is working.

adesh14 avatar Aug 08 '23 05:08 adesh14