
pycharm
43118
JonyChan技术学习过程中的总结
展开
-
Python实现将多个print的信息输出在一行的方法
在print()函数里面使用end=’ '参数print('Epoch:', epoch+1, end='')print(' | Batch index:', batch_idx, end='')print(' | Batch size:', y.size()[0])原创 2021-03-22 16:40:09 · 2501 阅读 · 0 评论 -
GAN的Pytorch实现
import numpy as npimport torchimport torch.nn as nnimport torch.optim as optimfrom matplotlib import pyplot as plt#torch.autograd提供了类和函数用来对任意标量函数进行求导。要想使用自动求导,# 只需要对已有的代码进行微小的改变。只需要将所有的tensor包含进Variable对象中即可。from torch.autograd import Variable#Da原创 2021-03-12 08:22:20 · 478 阅读 · 0 评论 -
plt.legend()画图例的几种例子
参考文档链接:https://pythonspot.com/matplotlib-legend/1.Place the legend insideTo place the legend inside, simply call legend():import matplotlib.pyplot as pltimport numpy as npy = [2,4,6,8,10,12,14,16,18,20]y2 = [10,11,12,13,14,15,16,17,18,19]x = np.ara原创 2021-03-06 10:09:08 · 2538 阅读 · 0 评论