未验证 提交 c2a79feb 编写于 作者: W wangna11BD 提交者: GitHub

fix 0 tensor in readme (#721)

上级 d42b46ca
...@@ -159,7 +159,7 @@ for pass_id in range(100): ...@@ -159,7 +159,7 @@ for pass_id in range(100):
optimizerD.clear_grad() optimizerD.clear_grad()
errD = errD_real + errD_fake errD = errD_real + errD_fake
losses[0].append(errD.numpy()[0]) losses[0].append(float(errD))
############################ ############################
# (2) Update G network: maximize log(D(G(z))) # (2) Update G network: maximize log(D(G(z)))
...@@ -174,7 +174,7 @@ for pass_id in range(100): ...@@ -174,7 +174,7 @@ for pass_id in range(100):
optimizerG.step() optimizerG.step()
optimizerG.clear_grad() optimizerG.clear_grad()
losses[1].append(errG.numpy()[0]) losses[1].append(float(errG))
############################ ############################
...@@ -196,7 +196,7 @@ for pass_id in range(100): ...@@ -196,7 +196,7 @@ for pass_id in range(100):
plt.xticks([]) plt.xticks([])
plt.yticks([]) plt.yticks([])
plt.subplots_adjust(wspace=0.1, hspace=0.1) plt.subplots_adjust(wspace=0.1, hspace=0.1)
msg = 'Epoch ID={0} Batch ID={1} \n\n D-Loss={2} G-Loss={3}'.format(pass_id, batch_id, errD.numpy()[0], errG.numpy()[0]) msg = 'Epoch ID={0} Batch ID={1} \n\n D-Loss={2} G-Loss={3}'.format(pass_id, batch_id, float(errD), float(errG))
print(msg) print(msg)
plt.suptitle(msg,fontsize=20) plt.suptitle(msg,fontsize=20)
plt.draw() plt.draw()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册