RuntimeError: The size of tensor a (320) must match the size of tensor b (10) at non-singleton dimension 2

correct = 0
total = 0
with torch.no_grad():
for data in testloader:
images, labels = data
outputs = train_model(images)
_, predicted = torch.max(outputs.data, 1)
total += labels.size(0)
correct += (predicted == labels).sum().item()

print(‘Accuracy of the network on the 10000 test images: %d %%’ % (
100 * correct / total))

Error occurred at --------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
in
7 _, predicted = torch.max(outputs.data, 1)
8 total += labels.size(0)
----> 9 correct += (predicted == labels).sum().item()
10