Here you using dataset_valid, but you are printing shape of dataset_train.



 patrick126:

accuracy_valid = 100. * predictions.eq(dataset_valid.dataset.targets).sum().float() / len(dataset_valid)


And also, it seems for predictions, you have used batch_size=5000 which lead to 5000 predictions but you are using labels of entire dataset which is 10000.
And I think you are not looping over batches and want to feed entire dataset to network, in this case change batch_size= dataset_valid.dataset.data.shape[0] in this line:



 patrick126:

dataloader_valid = torch.utils.data.DataLoader(dataset_valid, batch_size=500, num_workers=num_workers, pin_memory=True)