I understand that when using the no_grad() environment, the Autograd does not keep track of the computation graph and it’s similar to temporarily setting requires_grad to False whereas the detach() function returns a tensor which is detached from the computation graph.
My question is, is there any place where using detach() is necessary? It seems to me that we can always do everything using no_grad() instead.
Thanks