I moved my model to gpu
net.to(device)
but when i try to test the model , as per the
Pytorch tutorial
dataiter = iter(testloader)
images, labels = dataiter.next()
imshow(torchvision.utils.make_grid(images))
print('GroundTruth: ', ' '.join('%5s' % classes[labels[j]] for j in range(4)))
outputs = net(images) #This line throws the error
what is the issue ???
1 Like
You need to pass images to device also.
pass images to device by using below code
dataiter = iter(testloader)
images, labels = dataiter.next()
images,labels = images.to(device),labels.to(device)
2 Likes
PARISA
(DNG)
5
I have a problem. i mounted my data on google drive and when i want to train my model it has an issue same as below:
Make sure to push the input data to the device using:
input = input.cuda()
# or
input = input.to('cuda')
PARISA
(DNG)
7
thankyou so much. it helped.
ptrblck via PyTorch Forums <noreply@discuss.pytorch.org> در تاریخ دوشنبه ۶ آوریل ۲۰۲۰ ساعت ۸:۱۰ نوشت: