Hi,
I have one more question is that. Assuming I create a customized Pytorch API that will create a tensor inside the C++ function during the execution. For example.
A = create_a_CUDA_tensor_via_customized_CPP_function();

inside the  create_a_CUDA_tensor_via_customized_CPP_function(); I create and return a tensor like torch::ones().cuda().
if later on at some point, I want to assign A with another tensor.
A = Another_create_a_CUDA_tensor_via_customized_CPP_function();

Do I need to del A before I am calling the another function to avoid the GPU memory leak?
Thanks!