Cuda Out of Memory

In my case, I followed @justusschock advice and the issue of Out of Memory was gone.
To understand detach vs item, I would recommend this Pytorch Forum discussion.