Home > Blockchain >  Error: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same
Error: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same

Time:11-21

I am trying to train a DNN model using pytorch, and I want to use GPU to train my model. I am able to successfully copy my model to the GPU using model.to(device), where device = cuda:0.

However, the standard methods for copying input to the GPU, (Error Message

Please let me know where I am going wrong. Thank you!

CodePudding user response:

X.to(device) does nothing. change it to:

x=x.to(device)

Of course this should be done to any parameter\variable you want on the GPU

  • Related