Cannot transfer torch.Tensor to torch.cuda.Tensor
I use the following code to turn the torch.Tensor into torch.cuda.Tensor
import torch
import numpy as np

a = np.random.randn(1, 1, 2, 3)

t2 = torch.tensor(a)
t2 = t2.cuda()

t3 = torch.tensor(a, device=torch.device('cuda'))
print(type(t3), t3.device, type(t2), t2.device)

And its output is
&lt;class 'torch.Tensor'&gt; cuda:0 &lt;class 'torch.Tensor'&gt; cuda:0
I expect the class is 'torch.cuda.Tensor'. I don't know why this happens.
My torch version is 1.6.0 and the corresponding cuda version is 10.2

That is because there is no such class as torch.cuda.Tensor in PyTorch 1.6.0.
The t3.device and t2.device in print(type(t3), t3.device, type(t2), t2.device) prints cuda:0 which means your tensors are already on GPU.
