SKNet
SKNet copied to clipboard
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [8, 64, 32, 32]], which is output 0 of ReluBackward0, is at version 1; expected version 0 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later.
Run sknet.py, got RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [8, 64, 32, 32]], which is output 0 of ReluBackward0, is at version 1; expected version 0 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later.
environment: torch1.10 python3.8
x.squeeze(),x.unsqueeze_()操作将改变x。x.squeeze(),x.unsqueeze(),下划线去了,但不知道影响大不大
我也遇到了同样的问题,采用了一楼的方法成功解决,感谢一楼!!