What do the numbers after the grad_fn mean?

when you print a tensor



tensor([[3., 3.],
        [3., 3.]], grad_fn=<AddBackward0>)

grad_fn is appended with a function that calculates the derivative value and a number.
However, there are times when the number is 0 or 1, so I don’t know what the standard is.
What do the numbers after the function mean?


This number is used because we need different functions for different overloads of the forward function: add(Tensor, Tensor) or add(Tensor, Scalar) (not sure if you can actually call this one from python) for example where the first will get AddBackward0 and the second AddBackward1.
But in general, you can ignore it.

1 Like