Hi everyone, I am using PyTorch 1.7 and cuda 10.2, I found a strange thing, please see the following code and corresponding outputs:
test =torch.randn(3,3)
print(test.device)
test.to('cuda:0')
print(test.device)

test_2 = torch.randn(3,3,device='cuda:0')
print(test_2.device)

which has outputs:
cpu
cpu
cuda:0

It seems strange to me, since I can set its location onto gpu when initialize the tensor but cannot move it onto gpu if it was initialized on cpu, can anyone help me with this? Thanks in advance!