Replies: 1 comment
|
When tensor computation is not performed using a GPU, the generated Therefore, there's no need to use You can directly pass in: However, you must use When your tensor contains only one element (e.g., a scalar Remove gradients and device: Regardless of whether the tensor is on a GPU or CPU, and regardless of whether it has gradients. Convert the type: Directly convert this standard PyTorch scalar into a pure Python number (usually float or int). Because Python's native float lists can be perfectly recognized and plotted by Matplotlib, using |
Uh oh!
There was an error while loading. Please reload this page.
while plotting the list(epoch_count,loss_values,test_loss) in graph daniel was getting error to convert tensor values in numpy arr
when i used inference_mode() for my plot to graph and i dont need to do the conversion is this the right approach?
code:
#plot the loss curves
with torch.inference_mode():
plt.plot(epoch_count,loss_values,label="Train loss")
plt.plot(epoch_count,test_loss_values,label="Test loss")
plt.title("Training and test loss curves")
plt.ylabel("Loss")
plt.xlabel("Epochs")
All reactions