I am trying to save the predictions from my code as CSV file but getting this error message. Can someone please help? Thanks
  output = model(images)
   preds = output.sum(dim=[1,2,3])
   np.save('output.csv', preds)

I am getting this error message:
RuntimeError: Can’t call numpy() on Variable that requires grad. Use var.detach().numpy() instead.