Inferring from the fact that you coded torch.max(y_train, 1)[1]
y_train is a label of shape (N, Classes).
correctly_trained += (y_train.data==predicted_labels).sum()
is accumulating N * Classes instances, while total_trained += y_train.size(0) only accumulates N instances.
I think that’s why you get accuracy bigger than 1.