I did some testing on copying a tensor from GPU to CPU (.cpu() method) and it seems that Pytorch allocates a new chunk of “CPU” memory (RAM) every time the .cpu() method is executed.
Is there a way to copy a “GPU” tensor to a preallocated buffer in RAM (CPU side) using C++ ? I would like to avoid allocating new memory space for each “GPU to CPU” copy operation.