Created
October 17, 2019 14:25
-
-
Save sseveran/88938abb055e9e2e7651a8b3fc3b13a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compute the minimize_op. | |
params = model.trainable_variables | |
grads = optimizer.get_gradients(total_loss, params) | |
grads_and_vars = list(zip(grads, params)) | |
for gradient, variable in grads_and_vars: | |
var_name = variable.name.replace(":", "_") | |
tensorboard.summary.histogram(f"gradients/{var_name}", gradient) | |
tensorboard.summary.scalar(f"gradient_norm/{var_name}", tf.global_norm([gradient])) | |
minimize_op = optimizer.apply_gradients(grads_and_vars) | |
train_op = tf.group(minimize_op, update_ops) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment