I’m trying to train a network. I have set the device to “cuda”, and I run
net.to(device)

However, when I run
inputs = data["input"].float().to(device)
outputs = net(inputs)

I get an error at the outputs assignment.
“RuntimeError: Expected object of type torch.FloatTensor but found type torch.cuda.FloatTensor for argument #4 ‘mat1’”
Puzzlingly enough, with
inputs =  data["input"].float()
outputs = net(inputs)

I get, erring on the same last line of code, the “opposite error”:
“RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.FloatTensor for argument #4 ‘mat1’”
However, if I remove all “to(device)” then the code runs fine.
What might be going on here?
Thank you.