Do I have to free tensor in pytorch c++?

Hi,

While implementing my code using c++ API, I have a question about memory management in pyTorch.
In Python, memory management is automatically handle allocation and free. What about c++?? Do I have to manually free tensor that I allocated in c++ code?

Thanks,

LibTorch tracks the lifetime of your tensors (except when you use from_blob, in which case your tensors don’t own the memory), so you would not need to delete them except letting them go out of scope.

Best regards

Thomas