That is from a time long gone and anwering a different question.
- No. Between creating a new tensor requiring grad and using
.data
, which you never should these days, you created a new leaf which will accumulate.grad
. - Because you requested it.
no_grad
signals that you do not need the grad, it does not include guarantees about therequires_grad
of the result. - If the utility function does not work for you, dropping the
requires_grad
and the.data
should do the trick.
Best regards
Thomas