Got an error when using PacConv2d
Qi-X opened this issue · comments
I want to use PacConv2d, but I got an error when I ran the code. It seems that it was an inplace operation problem, and I don't know why.
Traceback (most recent call last):
File "main.py", line 167, in
train()
File "main.py", line 147, in train
loss.backward()
File "/usr/local/lib/python2.7/dist-packages/torch/tensor.py", line 93, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/usr/local/lib/python2.7/dist-packages/torch/autograd/init.py", line 89, in backward
allow_unreachable=True) # allow_unreachable flag
File "/usr/local/lib/python2.7/dist-packages/torch/autograd/function.py", line 76, in apply
return self._forward_cls.backward(self, *args)
File "/usr/local/lib/python2.7/dist-packages/torch/autograd/function.py", line 188, in wrapper
outputs = fn(ctx, *args)
File "/home/xq/contrast_convlstm/pac.py", line 182, in backward
input, kernel, weight = ctx.saved_tensors
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation
The error located at class PacConv2dFn(Function) backward function.
I hope your advice.
Thanks.
I am not sure whether that matters but we only tested with Python3.
Can you please report your Pytorch version? Also, do all the tests pass?
I use python2, pytorch0.4.0. I don't know how to do all the tests.
python -m unittest
will run all tests. Seeing whether any fails and which ones can help us diagnose.