0

I am trying to graph the loss of my neural network with pyplot. When I try to pass in the arguments to the function like so:

dataframe = dict (
    Epoch = epochsArray,
    Loss = lossesArray
)
figure = px.line(dataframe, x='Epoch', y='Loss', title='Loss Per Epoch') #This line is where the error is

I get an error from PyTorch: RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead. How can I call tensor.detach().numpy() inside a module that was imported?

0 Answers0