// in WGAN paper, values are clipped. This might not work, and is slow.
if(config.clipped_discriminator):
clip = [tf.assign(d,tf.clip_by_value(d, -config.clip_value, config.clip_value)) for d in d_vars]sess.run(clip)
if(d_class_loss is not None):
_, g_cost,d_fake,d_real,d_class = sess.run([g_optimizer, g_loss, d_fake_loss, d_real_loss, d_class_loss])
//print("%2d: g cost %.2f d_loss %.2f d_real %.2f d_class %.2f d_log %.2f" % (iteration, g_cost,d_cost, d_real, d_class, d_log ))
After Change
// in WGAN paper, values are clipped. This might not work, and is slow.
if(config.d_clipped_weights):
sess.run(gan.graph.clip)
if(d_class_loss is not None):
_, g_cost,d_fake,d_real,d_class = sess.run([g_optimizer, g_loss, d_fake_loss, d_real_loss, d_class_loss])
//print("%2d: g cost %.2f d_loss %.2f d_real %.2f d_class %.2f d_log %.2f" % (iteration, g_cost,d_cost, d_real, d_class, d_log ))