Your output should have the shape [batch_size, nb_classes], right?
If that’s the case, you should use np.argmax(yhat.to('cpu').detach().numpy(), axis=1) to get the predicted class for each sample in the batch.
Otherwise np.argmax will only return a single value for the entire array.