Can't call numpy() on Tensor that requires grad - Value error #983
Unanswered
Kullanicikukla61
asked this question in
Q&A
Replies: 1 comment
-
try using this code. plt.plot(epochArray, torch.Tensor(training_losses).numpy(), label = "Train Loss") |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
My plot function givees that error: RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.
I searched problem and find that: use that "y_pred = y_pred.detach().numpy()" before call function. This leads this: error: ValueError: x and y must be the same size.
I searched discussions. However did not understand anything.
(I updated my code according to course materials but did not changed anyting)
(restart run all is the same.)
there may be mistake in post but indentation is true. I am new at github.
Beta Was this translation helpful? Give feedback.
All reactions