parameters: (self,
                                         slot_variable_position,
                                         slot_name,
                                         variable,
                                         optional_op_name=None)
docstring: Restore a slot variable's value, possibly creating it.
  
      Called when a variable which has an associated slot variable is created or
      restored. When executing eagerly, we create the slot variable with a
      restoring initializer.
  
      No new variables are created when graph building. Instead,
      _restore_slot_variable catches these after normal creation and adds restore
      ops to the graph. This method is nonetheless important when graph building
      for the case when a slot variable has already been created but `variable`
      has just been added to a dependency graph (causing us to realize that the
      slot variable needs to be restored).
  
      Args:
        slot_variable_position: A `trackable._CheckpointPosition` object
          indicating the slot variable `Trackable` object to be restored.
        slot_name: The name of this `Optimizer`'s slot to restore into.
        variable: The variable object this slot is being created for.
        optional_op_name: Name to use when scoping the Variable that needs to be
          created for the slot.
docstring_summary: Restore a slot variable's value, possibly creating it.
docstring_tokens: Restore a slot variable s value possibly creating it .
function: def _create_or_restore_slot_variable(self,
                                         slot_variable_position,
                                         slot_name,
                                         variable,
                                         optional_op_name=None):
      """Restore a slot variable's value, possibly creating it.
  
      Called when a variable which has an associated slot variable is created or
      restored. When executing eagerly, we create the slot variable with a
      restoring initializer.
  
      No new variables are created when graph building. Instead,
      _restore_slot_variable catches these after normal creation and adds restore
      ops to the graph. This method is nonetheless important when graph building
      for the case when a slot variable has already been created but `variable`
      has just been added to a dependency graph (causing us to realize that the
      slot variable needs to be restored).
  
      Args:
        slot_variable_position: A `trackable._CheckpointPosition` object
          indicating the slot variable `Trackable` object to be restored.
        slot_name: The name of this `Optimizer`'s slot to restore into.
        variable: The variable object this slot is being created for.
        optional_op_name: Name to use when scoping the Variable that needs to be
          created for the slot.
      """
      slot_variable = self.get_slot(var=variable, name=slot_name)
      if (slot_variable is None and context.executing_eagerly() and
          slot_variable_position.is_simple_variable()
          # Defer slot variable creation if there is an active variable creator
          # scope. Generally we'd like to eagerly create/restore slot variables
          # when possible, but this may mean that scopes intended to catch
          # `variable` also catch its eagerly created slot variable
          # unintentionally (specifically make_template would add a dependency on
          # a slot variable if not for this case). Deferring is mostly harmless
          # (aside from double initialization), and makes variable creator scopes
          # behave the same way they do when graph building.
          and not ops.get_default_graph()._variable_creator_stack):  # pylint: disable=protected-access
        initializer = trackable.CheckpointInitialValue(
            checkpoint_position=slot_variable_position)
        slot_variable = self.create_slot(
            var=variable,
            val=initializer,
            slot_name=slot_name,
            optional_op_name=optional_op_name)
        # Optimizers do not have unconditional dependencies on their slot
        # variables (nor do any other objects). They are only saved if the
        # variables they were created for are also saved.
      if slot_variable is not None:
        # If we've either made this slot variable, or if we've pulled out an
        # existing slot variable, we should restore it.
        slot_variable_position.restore(slot_variable)
      else:
        # We didn't make the slot variable. Defer restoring until it gets created
        # normally. We keep a list rather than the one with the highest restore
        # UID in case slot variables have their own dependencies, in which case
        # those could differ between restores.
        variable_key = _var_key_v2(variable)
        self._deferred_slot_restorations.setdefault(slot_name, {}).setdefault(
            variable_key, []).append(slot_variable_position)
function_tokens: def _create_or_restore_slot_variable ( self , slot_variable_position , slot_name , variable , optional_op_name = None ) : slot_variable = self . get_slot ( var = variable , name = slot_name ) if ( slot_variable is None and context . executing_eagerly ( ) and slot_variable_position . is_simple_variable ( ) # Defer slot variable creation if there is an active variable creator # scope. Generally we'd like to eagerly create/restore slot variables # when possible, but this may mean that scopes intended to catch # `variable` also catch its eagerly created slot variable # unintentionally (specifically make_template would add a dependency on # a slot variable if not for this case). Deferring is mostly harmless # (aside from double initialization), and makes variable creator scopes # behave the same way they do when graph building. and not ops . get_default_graph ( ) . _variable_creator_stack ) : # pylint: disable=protected-access initializer = trackable . CheckpointInitialValue ( checkpoint_position = slot_variable_position ) slot_variable = self . create_slot ( var = variable , val = initializer , slot_name = slot_name , optional_op_name = optional_op_name ) # Optimizers do not have unconditional dependencies on their slot # variables (nor do any other objects). They are only saved if the # variables they were created for are also saved. if slot_variable is not None : # If we've either made this slot variable, or if we've pulled out an # existing slot variable, we should restore it. slot_variable_position . restore ( slot_variable ) else : # We didn't make the slot variable. Defer restoring until it gets created # normally. We keep a list rather than the one with the highest restore # UID in case slot variables have their own dependencies, in which case # those could differ between restores. variable_key = _var_key_v2 ( variable ) self . _deferred_slot_restorations . setdefault ( slot_name , { } ) . setdefault ( variable_key , [ ] ) . append ( slot_variable_position )