I built a simple network from a tutorial and I got this error:
RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.Flo
import torch import numpy as np x = torch.tensor(np.array(1), device='cuda:0') print(x.device) # Prints `cpu` x = torch.tensor(1, device='cuda:0') print(x.device) # Prints `cuda:0`
Now the tensor resides on GPU