提交 179363a1 编写于 作者: X Xin Pan

polish codes

test=develop
上级 bfa2621f
...@@ -171,16 +171,11 @@ class TestImperativeMnist(unittest.TestCase): ...@@ -171,16 +171,11 @@ class TestImperativeMnist(unittest.TestCase):
fluid.layers.sigmoid_cross_entropy_with_logits( fluid.layers.sigmoid_cross_entropy_with_logits(
x=d_fake, label=to_variable(np.ones([2, 1], np.float32)))) x=d_fake, label=to_variable(np.ones([2, 1], np.float32))))
g_loss._backward() g_loss._backward()
sgd = SGDOptimizer(learning_rate=1e-3)
sgd.minimize(g_loss) sgd.minimize(g_loss)
for p in discriminator.parameters(): for p in discriminator.parameters():
dy_params[p.name] = p._numpy() dy_params[p.name] = p._numpy()
sys.stderr.write('dy_param_loss: %s: %s\n' %
(p.name, np.sum(dy_params[p.name])))
for p in generator.parameters(): for p in generator.parameters():
dy_params[p.name] = p._numpy() dy_params[p.name] = p._numpy()
sys.stderr.write('dy_param_loss: %s: %s\n' %
(p.name, np.sum(dy_params[p.name])))
dy_g_loss = g_loss._numpy() dy_g_loss = g_loss._numpy()
dy_d_loss = d_loss._numpy() dy_d_loss = d_loss._numpy()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册