You can look at the chain of grad_fn and next_functions:
print(result.grad_fn)
print(result.grad_fn.next_functions)
print(result.grad_fn.next_functions[0][0].next_functions)
...

Usually the issue has something to do with either a detach() call (which stops backpropagation) or returning the input unmodified in forward. Try returning input.clone() to see if it fixes the issue.