Hi, thanks for the quick reply. It worked! yey.
However, I dont understand why.
In this post
the difference between clone and detach is explained as follows:
You should use
detach()
when attempting to remove a tensor from a computation graph, andclone
as a way to copy the tensor while still keeping the copy as a part of the computation graph it came from.
Maybe I am confusing the computatoinal graph and the memory adress. In my case I would like to remoe the grads
object form my graph or not?