So, I have a problem and I hope that you guys can help me figure out a solution for this.
so I wrote a model and trained it and I am trying to test it out.
and I get this error so here is the full sityuation:
device = 'cuda' if torch.cuda.is_available() else 'cpu' print(device) Model.eval() with torch.no_grad(): total_correct = 0 size_of_set = 0 for images, labels in DataLoader: images = images.to(device) print(images.device) labels = labels.to(device) preds = Model(images) total_correct+= get_correct(preds,labels)
So actually, the first print shows that cuda is available.
but the second one shows that the images are given to the cpu…
This is weird and then I get this error:
RuntimeError: expected device cuda:0 but got device cpu