Commit 76128e42 authored by Yuxin Wu's avatar Yuxin Wu

ensure global_step var is created in reuse=False

parent cddca55f
...@@ -45,9 +45,10 @@ def get_global_step_var(): ...@@ -45,9 +45,10 @@ def get_global_step_var():
scope = tf.get_variable_scope() scope = tf.get_variable_scope()
assert scope.name == '', \ assert scope.name == '', \
"Creating global_step_var under a variable scope would cause problems!" "Creating global_step_var under a variable scope would cause problems!"
var = tf.get_variable(GLOBAL_STEP_OP_NAME, shape=[], with tf.variable_scope(scope, reuse=False):
initializer=tf.zeros_initializer, var = tf.get_variable(GLOBAL_STEP_OP_NAME, shape=[],
trainable=False, dtype=tf.int32) initializer=tf.zeros_initializer,
trainable=False, dtype=tf.int32)
return var return var
def get_global_step(): def get_global_step():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment