Skip to content

Instantly share code, notes, and snippets.

@ageron
Created June 1, 2017 07:15
Show Gist options
  • Save ageron/3fd3193cbd44b9874bcfcc45fc2d6b32 to your computer and use it in GitHub Desktop.
Save ageron/3fd3193cbd44b9874bcfcc45fc2d6b32 to your computer and use it in GitHub Desktop.
Batch norm variable names in TensorFlow
>>> import tensorflow as tf
>>> X = tf.placeholder(shape=[None, 5], dtype=tf.float32, name="X")
>>> with tf.variable_scope("layer1"):
... hidden1 = tf.layers.dense(X, 100, name="hidden1")
... bn1 = tf.layers.batch_normalization(hidden1)
...
>>> for v in tf.global_variables():
... print(v.name)
...
layer1/hidden1/kernel:0
layer1/hidden1/bias:0
layer1/batch_normalization/beta:0
layer1/batch_normalization/gamma:0
layer1/batch_normalization/moving_mean:0
layer1/batch_normalization/moving_variance:0
>>> for v in tf.trainable_variables():
... print(v.name)
...
layer1/hidden1/kernel:0
layer1/hidden1/bias:0
layer1/batch_normalization/beta:0
layer1/batch_normalization/gamma:0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment