RuntimeError: The size of tensor a (64) must match the size of tensor b (7) at non-singleton dimension 1

I get the following Error

The function:

def test_accuracy(model, test_loader):
model.eval()
acc = 0.0
total = 0.0

with 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

I would suggest printing tensor.shape in before the operations and see if there is any apparent size mismatch.
Also, it will be helpful if you give the line number of the error.