C++ Aten command for accessing GPU tensors


(Jared Thompson) #1

Hi.

I am building a CUDA extension to python that uses PyTorch tensors. The tensors I want to access are allocated on the device (gpu tensors) from python. Inside of CUDA, I want to access the elements of one of these tensors from the host machine. This typically requires that the tensor is available on the cpu. In the python interface we have the .cpu() method available to tensors. The documentation says that this method is available in the C++ library, but when I try to access it, I get the following error:

/home/thompsjj/development/atomnet_v2/cuda/dev_2/voxelize.cu(145): error: class "at::Tensor" has no member "cpu"

So I’m really stuck here. How do I get the data from my gpu tensor, please?