I think there are some layers of code which makes it to output tensor type.
You can try to print x.type() instead of type(x) or x.device as it will tell you if it’s allocated on gpu or cpu.
import torch

a=torch.rand(5).cuda()
type(a)
Out[4]: torch.Tensor
a.type()
Out[6]: 'torch.cuda.FloatTensor'
a.device
Out[7]: device(type='cuda', index=0)