parameters: (session)
return_statement: return _default_session_stack.get_controller(weakref.ref(session))
docstring: Python "with" handler for defining a default session.
  
    This function provides a means of registering a session for handling
    Tensor.eval() and Operation.run() calls. It is primarily intended for use
    by session.Session, but can be used with any object that implements
    the Session.run() interface.
  
    Use with the "with" keyword to specify that Tensor.eval() and Operation.run()
    invocations within the scope of a block should be executed by a particular
    session.
  
    The default session applies to the current thread only, so it is always
    possible to inspect the call stack and determine the scope of a default
    session. If you create a new thread, and wish to use the default session
    in that thread, you must explicitly add a "with ops.default_session(sess):"
    block in that thread's function.
  
    Example:
      The following code examples are equivalent:
  
      # 1. Using the Session object directly:
      sess = ...
      c = tf.constant(5.0)
      sess.run(c)
  
      # 2. Using default_session():
      sess = ...
      with ops.default_session(sess):
        c = tf.constant(5.0)
        result = c.eval()
  
      # 3. Overriding default_session():
      sess = ...
      with ops.default_session(sess):
        c = tf.constant(5.0)
        with ops.default_session(...):
          c.eval(session=sess)
  
    Args:
      session: The session to be installed as the default session.
  
    Returns:
      A context manager for the default session.
docstring_summary: Python "with" handler for defining a default session.
docstring_tokens: Python with handler for defining a default session .
function: def default_session(session):
    """Python "with" handler for defining a default session.
  
    This function provides a means of registering a session for handling
    Tensor.eval() and Operation.run() calls. It is primarily intended for use
    by session.Session, but can be used with any object that implements
    the Session.run() interface.
  
    Use with the "with" keyword to specify that Tensor.eval() and Operation.run()
    invocations within the scope of a block should be executed by a particular
    session.
  
    The default session applies to the current thread only, so it is always
    possible to inspect the call stack and determine the scope of a default
    session. If you create a new thread, and wish to use the default session
    in that thread, you must explicitly add a "with ops.default_session(sess):"
    block in that thread's function.
  
    Example:
      The following code examples are equivalent:
  
      # 1. Using the Session object directly:
      sess = ...
      c = tf.constant(5.0)
      sess.run(c)
  
      # 2. Using default_session():
      sess = ...
      with ops.default_session(sess):
        c = tf.constant(5.0)
        result = c.eval()
  
      # 3. Overriding default_session():
      sess = ...
      with ops.default_session(sess):
        c = tf.constant(5.0)
        with ops.default_session(...):
          c.eval(session=sess)
  
    Args:
      session: The session to be installed as the default session.
  
    Returns:
      A context manager for the default session.
    """
    return _default_session_stack.get_controller(weakref.ref(session))
function_tokens: def default_session ( session ) : return _default_session_stack . get_controller ( weakref . ref ( session ) )