()
return not in_v1_while_loop
Returns True if a default caching device should be set, otherwise False.
Returns True if a default caching device should be set, otherwise False.
Returns True if a default caching device should be set otherwise False .
def _should_cache_variables():
  """Returns True if a default caching device should be set, otherwise False."""
  # Don't set a caching device when running in a loop, since it is possible that
  # train steps could be wrapped in a tf.while_loop. In that scenario caching
  # prevents forward computations in loop iterations from re-reading the
  # updated weights.
  graph = tf.get_default_graph()
  ctxt = graph._get_control_flow_context()  # pylint: disable=protected-access
  in_v1_while_loop = (
      control_flow_util.GetContainingWhileContext(ctxt) is not None)
  return not in_v1_while_loop
def _should_cache_variables ( ) : # Don't set a caching device when running in a loop, since it is possible that # train steps could be wrapped in a tf.while_loop. In that scenario caching # prevents forward computations in loop iterations from re-reading the # updated weights. graph = tf . get_default_graph ( ) ctxt = graph . _get_control_flow_context ( ) # pylint: disable=protected-access in_v1_while_loop = ( control_flow_util . GetContainingWhileContext ( ctxt ) is not None ) return not in_v1_while_loop