Calculate Model Accuracy for one of the Kaggle Notebook

How to calculate accuracy for PyTorch model used in 🐳Whales&Dolphins: EffNet Train & RAPIDS Clusters | Kaggle

I tried using some methods like -

  1. Tried this →
    correct += (out == targets).float().sum()
    accuracy = 100 * correct / len(test)
    This is giving weird errors and

  2. Tried this →
    num_corrects = num_corrects + torch.sum(out.argmax(1) == targets)
    print(“Accuracy = {}”.format(train_accuracy))
    This is giving 0 as accuracy

Please could anyone help me on it