I cannot move a tensor created on the GPU to the CPU in libtorch.
I do:
auto options_for_Psi_spec = torch::TensorOptions().dtype(torch::kComplexDouble).device(torch::kCUDA, 0);
torch::Tensor Psi_spec = torch::zeros( {100, 32, 65}, options_for_Psi_spec );
Psi_spec.to(torch::kCPU);
std::cout << Psi_spec.device() << std::endl;
This produces the output:
cuda:0
I have also tried with Psi_spec.to("cpu")
and with Psi_spec.cpu()
, but the same output appears.
What is the command to move a tensor from GPU to CPU in libtorch?