How to effectively release a Tensor in Pytorch?

In Python del tensor will work, in libtorch you could use e.g. this approach.

2 Likes