parameters: (self, op)
docstring: Add `op` to the current context.
  
      In the case that op has only external data inputs, we remove all of its
      external control inputs so all its inputs are in the same while loop
      context. This is valid because op now has an Enter input that has all
      the right control dependency.
docstring_summary: Add `op` to the current context.
docstring_tokens: Add op to the current context .
function: def _AddOpInternal(self, op):
      """Add `op` to the current context.
  
      In the case that op has only external data inputs, we remove all of its
      external control inputs so all its inputs are in the same while loop
      context. This is valid because op now has an Enter input that has all
      the right control dependency.
      """
      if not op.inputs:
        # Remove any external control dependency on this op
        control_inputs = [x for x in op.control_inputs
                          if x._get_control_flow_context() == self]
        if len(control_inputs) != len(op.control_inputs):
          del op.control_inputs[:]
          op._add_control_inputs(control_inputs)
        if not control_inputs:
          # Add a control edge from the control pivot to this op.
          # pylint: disable=protected-access
          op._add_control_input(self.GetControlPivot().op)
          # pylint: enable=protected-access
        for x in op.outputs:
          self._values.add(x.name)
      else:
        has_internal_data_input = False
        for index in range(len(op.inputs)):
          x = op.inputs[index]
          self.AddValue(x)
          real_x = self._external_values.get(x.name)
          if real_x is not None:
            op._update_input(index, real_x)
          else:
            has_internal_data_input = True
        if not has_internal_data_input:
          # Remove any external control dependency on this op
          control_inputs = [x for x in op.control_inputs
                            if x._get_control_flow_context() == self]
          if len(control_inputs) != len(op.control_inputs):
            del op.control_inputs[:]
            op._add_control_inputs(control_inputs)
        # Add a control dependency to prevent loop invariants from
        # enabling ops that should not be executed.
        self._MaybeAddControlDependency(op)
        for x in op.outputs:
          self._values.add(x.name)
      if self._outer_context or op.type not in {"Exit", "RefExit"}:
        op.graph.prevent_fetching(op)
function_tokens: def _AddOpInternal ( self , op ) : if not op . inputs : # Remove any external control dependency on this op control_inputs = [ x for x in op . control_inputs if x . _get_control_flow_context ( ) == self ] if len ( control_inputs ) != len ( op . control_inputs ) : del op . control_inputs [ : ] op . _add_control_inputs ( control_inputs ) if not control_inputs : # Add a control edge from the control pivot to this op. # pylint: disable=protected-access op . _add_control_input ( self . GetControlPivot ( ) . op ) # pylint: enable=protected-access for x in op . outputs : self . _values . add ( x . name ) else : has_internal_data_input = False for index in range ( len ( op . inputs ) ) : x = op . inputs [ index ] self . AddValue ( x ) real_x = self . _external_values . get ( x . name ) if real_x is not None : op . _update_input ( index , real_x ) else : has_internal_data_input = True if not has_internal_data_input : # Remove any external control dependency on this op control_inputs = [ x for x in op . control_inputs if x . _get_control_flow_context ( ) == self ] if len ( control_inputs ) != len ( op . control_inputs ) : del op . control_inputs [ : ] op . _add_control_inputs ( control_inputs ) # Add a control dependency to prevent loop invariants from # enabling ops that should not be executed. self . _MaybeAddControlDependency ( op ) for x in op . outputs : self . _values . add ( x . name ) if self . _outer_context or op . type not in { "Exit" , "RefExit" } : op . graph . prevent_fetching ( op )