uidilr / gail_ppo_tf

Tensorflow implementation of Generative Adversarial Imitation Learning(GAIL) with discrete action
MIT License
112 stars 29 forks source link

Visualize the Gradients in the discriminator on the Tensor-board #13

Closed shamanez closed 6 years ago

shamanez commented 6 years ago

Hi , I think it is useful to visualize gradients in discriminator. Instead of using Adam optimizer in the given way I used,

optimizer = tf.train.AdamOptimizer() grads = optimizer.compute_gradients(cross_entropy) train_step = optimizer.apply_gradients(grads) for index, grad in enumerate(grads): tf.summary.histogram("{}-grad".format(grads[index][1].name), grads[index])

uidilr commented 6 years ago

Does enumeration of grads (tensorflow variables) works ? I think tensorflow variables are not iterable.

for index, grad in enumerate(grads):
    tf.summary.histogram("{}-grad".format(grads[index][1].name), grads[index])
shamanez commented 6 years ago

yeah it worked. Sorry for the mistake I used this

gradients = optimizer.compute_gradients(loss, var_list=pi_trainable)

_

uidilr commented 6 years ago

Okay. Could you make the Pull Request with these codes?

shamanez commented 6 years ago

I modified the code to visualize layer weights, activations, and gradients in the censor board. I will pull request as soon as possible just after I tested it bit more.