Closed xiezouqu closed 4 months ago
Hi @xiezouqu,
The tensor.grad
attribute only works when the tensor has requires_grad
set to True
. Normally it's only applied to the network parameters that will be updated. If you want to get the gradient of the parameters, you need to call .grad
on those parameters.
Fred.
Hi @fredzzhang Thank you very much for your response!
Hello, I respectfully appreciate the work you have done. I encountered the following issue during getting grad of inputs, and I would greatly appreciate your help in solving it.
function def _on_each_iteration(self): in util.py
but grad is None, I want to know how to get the correct the grad.and I would greatly appreciate your help in solving it. @fredzzhang