I’d like to explore the computation graph recorded by autograd manually. I’ve been playing around with next_functions, which seems to be relevant to my needs:
x = torch.ones(4, requires_grad=True)
loss = x.pow(2)
print(loss.grad_fn)
print(loss.grad_fn.next_functions[0])

But I’m not sure I completely understand what’s going on. Each element of next_functions is a tuple of a function object and a number. I don’t know what those numbers are. Also, I haven’t found a way to access the input tensor x just by accessing attributes or calling methods on loss. How can I do it?