I am noob to PyTorch and I am trying to train my model(estimating affine transformation between two images). The code was run on google colab. When I try to run it on cpu(without device cuda), it works but when I put both the data and weight(model) into the device it has following error coming out. I have uploaded the screenshots.

"Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same or input should be a tensor and weight is a dense tensor"

Are there any suggestions? It will be really helpful XD

I tried with cases putting both inputs and weights into GPU but still didn't work :(

enter image description here

batch_size = 8
TrainLoader = DataLoader(TrainingData, batch_size)
model = CombinedModel().to(device)

optimizer = optim.Adam(model.parameters(), lr=0.005)

for i, (image1, image2, target) in enumerate(TrainLoader):
   image1 = image1.to(device)
   image2 = image2.to(device)
   target = target.to(device)
   outputs = model(image1, image2)
   print(outputs)
   print(outputs.shape)

enter image description here

0

There are 0 best solutions below