epochs = list(range(1, num_epochs + 1))标签:Loss,Training,plt,函数,plot,损失,epochs,train,图片 From: https://www.cnblogs.com/mxleader/p/17823450.html
train_losses = [] # 用于存储每个epoch的训练损失
plt.plot(epochs, train_losses, label='Training Loss')
plt.title('Training Loss Over Epochs')
plt.xlabel('Epochs')
plt.ylabel('Loss')
plt.legend()
plt.savefig('training_loss_plot.png')