I get the following Error
The function:
def test_accuracy(model, test_loader):
model.eval()
acc = 0.0
total = 0.0with torch.no_grad(): for data in test_loader: images, labels = data images = images.to(torch.device('cuda')) labels = labels.to(torch.device('cuda')) # run the model on the test set to predict labels outputs = model(images) # the label with the highest energy will be our prediction _, predicted = torch.max(outputs.data, 1) total += labels.size(0) acc += (predicted == labels).sum().item() # compute the accuracy over all test images acc = (100 * acc / total) return (acc)
I would really appreciate your help,
thank you in advance
Blockquote