parameters: (self, next_creator, **kwargs)
return_statement: return v
docstring: Creates variables & adds them to collections to match legacy code.
docstring_summary: Creates variables & adds them to collections to match legacy code.
docstring_tokens: Creates variables & adds them to collections to match legacy code .
function: def variable_creator_scope(self, next_creator, **kwargs):
      """Creates variables & adds them to collections to match legacy code."""
      collections = kwargs.pop("collections", None)
      v = None
  
      # Get expected variable name.
      with ops.name_scope(kwargs.get("name", None), "Variable") as name:
        variable_name = ops.name_from_scope_name(name)
        kwargs["name"] = name
  
      if self._share_variables:
        v = self._variables_by_name.get(variable_name, None)
  
      if v is None:
        v = next_creator(**kwargs)
        self._variables_by_name[variable_name] = v
  
      if collections is None:
        collections = [ops.GraphKeys.GLOBAL_VARIABLES]
      if v.trainable and ops.GraphKeys.TRAINABLE_VARIABLES not in collections:
        collections = list(collections) + [ops.GraphKeys.TRAINABLE_VARIABLES]
  
      ops.add_to_collections(collections, v)
  
      return v
function_tokens: def variable_creator_scope ( self , next_creator , * * kwargs ) : collections = kwargs . pop ( "collections" , None ) v = None # Get expected variable name. with ops . name_scope ( kwargs . get ( "name" , None ) , "Variable" ) as name : variable_name = ops . name_from_scope_name ( name ) kwargs [ "name" ] = name if self . _share_variables : v = self . _variables_by_name . get ( variable_name , None ) if v is None : v = next_creator ( * * kwargs ) self . _variables_by_name [ variable_name ] = v if collections is None : collections = [ ops . GraphKeys . GLOBAL_VARIABLES ] if v . trainable and ops . GraphKeys . TRAINABLE_VARIABLES not in collections : collections = list ( collections ) + [ ops . GraphKeys . TRAINABLE_VARIABLES ] ops . add_to_collections ( collections , v ) return v