I tried this way:
This is my accuracy function, below is an example I got
def multi_acc(y_pred, y_test):
_, y_pred_tags = torch.max(y_pred, dim = 1) 

correct_pred = (y_pred_tags == y_test)
acc = correct_pred.sum().float() / float(y_test.size(0))    

acc = torch.round(acc * 100)    

return acc

The sample values are,
This is y_train_pred::
tensor([[2.8131e-11, 6.4750e-18, 3.4827e-11, 1.6649e-14, 1.2475e-18, 6.9461e-11,
9.9766e-01, 5.3941e-11, 3.6331e-04, 1.9774e-03, 1.5335e-16, 5.1920e-07,
4.3097e-23, 4.7971e-07, 5.6579e-11, 1.7530e-09, 1.9532e-07, 6.3639e-07,
1.3673e-20, 1.2954e-18, 2.0057e-15, 1.0786e-14, 1.1804e-07, 1.2188e-15]],
grad_fn=)
y_train_batch, also the y_test for the accuracy function
tensor([[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
and the correct_pred value from the accuracy function.
tensor([[False, False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False, False,
False, False, False, False]])
I don’t understand where exactly the problem, I just ran for 10 epochs and got accuracy as 0. Not sure why