未验证 提交 ac98044f 编写于 作者: W whs 提交者: GitHub

Fix c_gan. (#1333)

上级 9f9817d3
...@@ -163,8 +163,9 @@ def train(args): ...@@ -163,8 +163,9 @@ def train(args):
total_images = np.concatenate([real_image, generated_images]) total_images = np.concatenate([real_image, generated_images])
fig = plot(total_images) fig = plot(total_images)
msg = "Epoch ID={0}\n Batch ID={1}\n D-Loss={2}\n DG-Loss={3}\n gen={4}".format( msg = "Epoch ID={0}\n Batch ID={1}\n D-Loss={2}\n DG-Loss={3}\n gen={4}".format(
pass_id, batch_id, np.mean(d_loss_np), dg_loss_np, pass_id, batch_id,
check(generated_images)) np.sum(d_loss_np),
np.sum(dg_loss_np), check(generated_images))
print(msg) print(msg)
plt.title(msg) plt.title(msg)
plt.savefig( plt.savefig(
......
...@@ -150,7 +150,8 @@ def train(args): ...@@ -150,7 +150,8 @@ def train(args):
fig = plot(total_images) fig = plot(total_images)
msg = "Epoch ID={0} Batch ID={1} D-Loss={2} DG-Loss={3}\n gen={4}".format( msg = "Epoch ID={0} Batch ID={1} D-Loss={2} DG-Loss={3}\n gen={4}".format(
pass_id, batch_id, pass_id, batch_id,
np.mean(d_loss_np), dg_loss_np, check(generated_images)) np.sum(d_loss_np),
np.sum(dg_loss_np), check(generated_images))
print(msg) print(msg)
plt.title(msg) plt.title(msg)
plt.savefig( plt.savefig(
......
...@@ -101,7 +101,7 @@ def D_cond(image, y): ...@@ -101,7 +101,7 @@ def D_cond(image, y):
h2 = bn(fc(h1, dfc_dim), act='leaky_relu') h2 = bn(fc(h1, dfc_dim), act='leaky_relu')
h2 = fluid.layers.concat([h2, y], 1) h2 = fluid.layers.concat([h2, y], 1)
h3 = fc(h2, 1) h3 = fc(h2, 1, act='sigmoid')
return h3 return h3
...@@ -131,7 +131,7 @@ def D(x): ...@@ -131,7 +131,7 @@ def D(x):
x = conv(x, df_dim, act='leaky_relu') x = conv(x, df_dim, act='leaky_relu')
x = bn(conv(x, df_dim * 2), act='leaky_relu') x = bn(conv(x, df_dim * 2), act='leaky_relu')
x = bn(fc(x, dfc_dim), act='leaky_relu') x = bn(fc(x, dfc_dim), act='leaky_relu')
x = fc(x, 1, act=None) x = fc(x, 1, act='sigmoid')
return x return x
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册