jcjohnson/pytorch-examples

A problem in PyTorch: Defining new autograd functions: input,=self.saved_tensors

Closed this issue · 1 comments

I'm sorry to open an issue here,but I want to raise a problem in the part:"PyTorch: Defining new autograd functions",the problem is that
Below class ReLu, function backward, here is a code :input,=self.saved_tensors, when I move the "," behind "input", and run the code "loss.backward()"below,I get an error:

File "/home/ry-feng/anaconda3/envs/python36/lib/python3.6/site-packages/torch/autograd/variable.py", line 146, in backward
self._execution_engine.run_backward((self,), (gradient,), retain_variables)
File "", line 8, in backward
TypeError: '<' not supported between instances of 'tuple' and 'int'

When I add "," ,the program can run normally, I don't know what cause this problem, I hope I could get some help from you, thanks a lot.

input, means change the type of input to turple.