Getting out of memory error while calculating accuracy. The following code is used to calculate
out = model(x)
batch_acc = 0.0
pred = out.max(1)[1].unsqueeze(1)
batch_acc = ((y == pred).sum().item() * 1.0) / len(y)