parameters: (name_or_scope,
                     reuse=None,
                     initializer=None,
                     regularizer=None,
                     caching_device=None,
                     partitioner=None,
                     custom_getter=None,
                     dtype=None)
docstring: Returns a context for variable scope.
  
    Variable scope allows to create new variables and to share already created
    ones while providing checks to not create or share by accident. For details,
    see the [Variable Scope How To](../../how_tos/variable_scope/index.md),
    here we present only a few basic examples.
  
    Simple example of how to create a new variable:
  
    ```python
    with tf.variable_scope("foo"):
        with tf.variable_scope("bar"):
            v = tf.get_variable("v", [1])
            assert v.name == "foo/bar/v:0"
    ```
  
    Basic example of sharing a variable:
  
    ```python
    with tf.variable_scope("foo"):
        v = tf.get_variable("v", [1])
    with tf.variable_scope("foo", reuse=True):
        v1 = tf.get_variable("v", [1])
    assert v1 == v
    ```
  
    Sharing a variable by capturing a scope and setting reuse:
  
    ```python
    with tf.variable_scope("foo") as scope:
        v = tf.get_variable("v", [1])
        scope.reuse_variables()
        v1 = tf.get_variable("v", [1])
    assert v1 == v
    ```
  
    To prevent accidental sharing of variables, we raise an exception when
    getting an existing variable in a non-reusing scope.
  
    ```python
    with tf.variable_scope("foo"):
        v = tf.get_variable("v", [1])
        v1 = tf.get_variable("v", [1])
        #  Raises ValueError("... v already exists ...").
    ```
  
    Similarly, we raise an exception when trying to get a variable that
    does not exist in reuse mode.
  
    ```python
    with tf.variable_scope("foo", reuse=True):
        v = tf.get_variable("v", [1])
        #  Raises ValueError("... v does not exists ...").
    ```
  
    Note that the `reuse` flag is inherited: if we open a reusing scope,
    then all its sub-scopes become reusing as well.
  
    Args:
      name_or_scope: `string` or `VariableScope`: the scope to open.
      reuse: `True` or `None`; if `True`, we go into reuse mode for this scope as
        well as all sub-scopes; if `None`, we just inherit the parent scope reuse.
      initializer: default initializer for variables within this scope.
      regularizer: default regularizer for variables within this scope.
      caching_device: default caching device for variables within this scope.
      partitioner: default partitioner for variables within this scope.
      custom_getter: default custom getter for variables within this scope.
      dtype: type of variables created in this scope (defaults to the type
        in the passed scope, or inherited from parent scope).
  
    Returns:
      A scope that can be to captured and reused.
  
    Raises:
      ValueError: when trying to reuse within a create scope, or create within
        a reuse scope, or if reuse is not `None` or `True`.
      TypeError: when the types of some arguments are not appropriate.
docstring_summary: Returns a context for variable scope.
docstring_tokens: Returns a context for variable scope .
function: def variable_scope(name_or_scope,
                     reuse=None,
                     initializer=None,
                     regularizer=None,
                     caching_device=None,
                     partitioner=None,
                     custom_getter=None,
                     dtype=None):
    """Returns a context for variable scope.
  
    Variable scope allows to create new variables and to share already created
    ones while providing checks to not create or share by accident. For details,
    see the [Variable Scope How To](../../how_tos/variable_scope/index.md),
    here we present only a few basic examples.
  
    Simple example of how to create a new variable:
  
    ```python
    with tf.variable_scope("foo"):
        with tf.variable_scope("bar"):
            v = tf.get_variable("v", [1])
            assert v.name == "foo/bar/v:0"
    ```
  
    Basic example of sharing a variable:
  
    ```python
    with tf.variable_scope("foo"):
        v = tf.get_variable("v", [1])
    with tf.variable_scope("foo", reuse=True):
        v1 = tf.get_variable("v", [1])
    assert v1 == v
    ```
  
    Sharing a variable by capturing a scope and setting reuse:
  
    ```python
    with tf.variable_scope("foo") as scope:
        v = tf.get_variable("v", [1])
        scope.reuse_variables()
        v1 = tf.get_variable("v", [1])
    assert v1 == v
    ```
  
    To prevent accidental sharing of variables, we raise an exception when
    getting an existing variable in a non-reusing scope.
  
    ```python
    with tf.variable_scope("foo"):
        v = tf.get_variable("v", [1])
        v1 = tf.get_variable("v", [1])
        #  Raises ValueError("... v already exists ...").
    ```
  
    Similarly, we raise an exception when trying to get a variable that
    does not exist in reuse mode.
  
    ```python
    with tf.variable_scope("foo", reuse=True):
        v = tf.get_variable("v", [1])
        #  Raises ValueError("... v does not exists ...").
    ```
  
    Note that the `reuse` flag is inherited: if we open a reusing scope,
    then all its sub-scopes become reusing as well.
  
    Args:
      name_or_scope: `string` or `VariableScope`: the scope to open.
      reuse: `True` or `None`; if `True`, we go into reuse mode for this scope as
        well as all sub-scopes; if `None`, we just inherit the parent scope reuse.
      initializer: default initializer for variables within this scope.
      regularizer: default regularizer for variables within this scope.
      caching_device: default caching device for variables within this scope.
      partitioner: default partitioner for variables within this scope.
      custom_getter: default custom getter for variables within this scope.
      dtype: type of variables created in this scope (defaults to the type
        in the passed scope, or inherited from parent scope).
  
    Returns:
      A scope that can be to captured and reused.
  
    Raises:
      ValueError: when trying to reuse within a create scope, or create within
        a reuse scope, or if reuse is not `None` or `True`.
      TypeError: when the types of some arguments are not appropriate.
    """
    if not isinstance(name_or_scope, (VariableScope,) + six.string_types):
      raise TypeError("VariableScope: name_or_scope must be a string or "
                      "VariableScope.")
    if isinstance(name_or_scope, six.string_types):
      name_scope = name_or_scope
    else:
      name_scope = name_or_scope.name.split("/")[-1]
    if name_scope:
      with ops.name_scope(name_scope) as cur_name_scope:
        if isinstance(name_or_scope, six.string_types):
          old_name_scope = cur_name_scope
        else:
          old_name_scope = name_or_scope.original_name_scope
        with _pure_variable_scope(
            name_or_scope,
            reuse=reuse,
            initializer=initializer,
            regularizer=regularizer,
            caching_device=caching_device,
            partitioner=partitioner,
            custom_getter=custom_getter,
            old_name_scope=old_name_scope,
            dtype=dtype) as vs:
          yield vs
    else:
      # This can only happen if someone is entering the root variable scope.
      with _pure_variable_scope(
          name_or_scope,
          reuse=reuse,
          initializer=initializer,
          regularizer=regularizer,
          caching_device=caching_device,
          partitioner=partitioner,
          custom_getter=custom_getter,
          dtype=dtype) as vs:
        yield vs
function_tokens: def variable_scope ( name_or_scope , reuse = None , initializer = None , regularizer = None , caching_device = None , partitioner = None , custom_getter = None , dtype = None ) : if not isinstance ( name_or_scope , ( VariableScope , ) + six . string_types ) : raise TypeError ( "VariableScope: name_or_scope must be a string or " "VariableScope." ) if isinstance ( name_or_scope , six . string_types ) : name_scope = name_or_scope else : name_scope = name_or_scope . name . split ( "/" ) [ - 1 ] if name_scope : with ops . name_scope ( name_scope ) as cur_name_scope : if isinstance ( name_or_scope , six . string_types ) : old_name_scope = cur_name_scope else : old_name_scope = name_or_scope . original_name_scope with _pure_variable_scope ( name_or_scope , reuse = reuse , initializer = initializer , regularizer = regularizer , caching_device = caching_device , partitioner = partitioner , custom_getter = custom_getter , old_name_scope = old_name_scope , dtype = dtype ) as vs : yield vs else : # This can only happen if someone is entering the root variable scope. with _pure_variable_scope ( name_or_scope , reuse = reuse , initializer = initializer , regularizer = regularizer , caching_device = caching_device , partitioner = partitioner , custom_getter = custom_getter , dtype = dtype ) as vs : yield vs