Worst accuracy in test phase

In train phase the model is showing 0.8 accuracy but in test phase the accuracy is reduced to 0.2
Is there any thing wrong in my code.
test_iterator = torch.utils.data.TensorDataset(x_test, y_test.reshape(-1).long())
test_data = torch.utils.data.DataLoader(test_iterator, batch_size = 64, shuffle = True)

Test the model

model.eval()
#with torch.no_grad():
accuracy = 0
for features, labels in test_data:
outputs = model(features)
accuracy += (outputs.argmax(1) == labels).float().mean()

print(f’Accuracy: {(accuracy/batches):.8f}’)

You have to divide the accuracy summed over test data by number of batches in test data, not train data. So print accuracy as print(f’Accuracy: {(accuracy/len(test_data):.8f}’)

its done bro, thanks again for you time.