message: Use the Snapshot kernel to force a copy of global step instead of the ugly "x + 0" hack.
diff: @@ -23,6 +23,7 @@ from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import graph_io
  from tensorflow.python.framework import ops
  +from tensorflow.python.ops import gen_array_ops
  from tensorflow.python.ops import init_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import state_ops
  @@ -221,7 +222,6 @@ def _get_or_create_global_step_read(graph=None):
  global_step_tensor = get_global_step(graph)
  if global_step_tensor is None:
  return None
  - # add 'zero' so that it will create a copy of variable as Tensor.
  with graph.as_default() as g, g.name_scope(None):
  with g.name_scope(global_step_tensor.op.name + '/'):
  # using initialized_value to ensure that global_step is initialized before
  @@ -229,7 +229,10 @@ def _get_or_create_global_step_read(graph=None):
  # under global_step_read_tensor dependency.
  global_step_value = global_step_tensor.initialized_value() if isinstance(
  global_step_tensor, variables.Variable) else global_step_tensor
  - global_step_read_tensor = global_step_value + 0
  + # pylint: disable=protected-access
  + # We use the snapshot kernel to make sure a copy is made of this tensor.
  + global_step_read_tensor = gen_array_ops._snapshot(global_step_value)
  + # pylint: enable=protected-access
  ops.add_to_collection(GLOBAL_STEP_READ_KEY, global_step_read_tensor)
  return _get_global_step_read(graph)
  