parameters: (sgv0, sgv1, mode)
docstring: Remap in place the inputs of two subgraph views to mimic the reroute.
  
    This function is meant to used by reroute_inputs only.
  
    Args:
      sgv0: the first subgraph to have its inputs remapped.
      sgv1: the second subgraph to have its inputs remapped.
      mode: reroute mode, see _reroute_ts(...).
    Raises:
      TypeError: if svg0 or svg1 are not SubGraphView.
      ValueError: if sgv0 and sgv1 do not belong to the same graph.
docstring_summary: Remap in place the inputs of two subgraph views to mimic the reroute.
docstring_tokens: Remap in place the inputs of two subgraph views to mimic the reroute .
function: def _reroute_sgv_remap(sgv0, sgv1, mode):
    """Remap in place the inputs of two subgraph views to mimic the reroute.
  
    This function is meant to used by reroute_inputs only.
  
    Args:
      sgv0: the first subgraph to have its inputs remapped.
      sgv1: the second subgraph to have its inputs remapped.
      mode: reroute mode, see _reroute_ts(...).
    Raises:
      TypeError: if svg0 or svg1 are not SubGraphView.
      ValueError: if sgv0 and sgv1 do not belong to the same graph.
    """
    a2b, b2a = _RerouteMode.check(mode)
    if not isinstance(sgv0, _subgraph.SubGraphView):
      raise TypeError("Expected a SubGraphView, got {}".format(type(sgv0)))
    if not isinstance(sgv1, _subgraph.SubGraphView):
      raise TypeError("Expected a SubGraphView, got {}".format(type(sgv1)))
    _util.check_graphs(sgv0, sgv1)
    sgv0_ = sgv0.copy()
    sgv1_ = sgv1.copy()
    # pylint: disable=protected-access
    if a2b and b2a:
      (sgv0_._input_ts, sgv1_._input_ts) = (sgv1_._input_ts, sgv0_._input_ts)
      (sgv0_._passthrough_ts, sgv1_._passthrough_ts) = (sgv1_._passthrough_ts,
                                                        sgv0_._passthrough_ts)
    elif a2b:
      sgv1_._input_ts = sgv0_._input_ts[:]
      sgv1_._passthrough_ts = sgv0_._passthrough_ts[:]
    elif b2a:
      sgv0_._input_ts = sgv1_._input_ts[:]
      sgv0_._passthrough_ts = sgv1_._passthrough_ts[:]
    # pylint: enable=protected-access
  
    # Update the passthrough outputs as well.
    def update_passthrough_outputs(a, b):
      # pylint: disable=protected-access
      for i, t in enumerate(b._output_ts):
        if t in a._passthrough_ts:
          ii = a._input_ts.index(t)
          b._output_ts[i] = b._input_ts[ii]
      # pylint: enable=protected-access
  
    if a2b:
      update_passthrough_outputs(sgv0_, sgv1_)
    if b2a:
      update_passthrough_outputs(sgv1_, sgv0_)
  
    # in-place
    # pylint: disable=protected-access
    sgv0._assign_from(sgv0_)
    sgv1._assign_from(sgv1_)
function_tokens: def _reroute_sgv_remap ( sgv0 , sgv1 , mode ) : a2b , b2a = _RerouteMode . check ( mode ) if not isinstance ( sgv0 , _subgraph . SubGraphView ) : raise TypeError ( "Expected a SubGraphView, got {}" . format ( type ( sgv0 ) ) ) if not isinstance ( sgv1 , _subgraph . SubGraphView ) : raise TypeError ( "Expected a SubGraphView, got {}" . format ( type ( sgv1 ) ) ) _util . check_graphs ( sgv0 , sgv1 ) sgv0_ = sgv0 . copy ( ) sgv1_ = sgv1 . copy ( ) # pylint: disable=protected-access if a2b and b2a : ( sgv0_ . _input_ts , sgv1_ . _input_ts ) = ( sgv1_ . _input_ts , sgv0_ . _input_ts ) ( sgv0_ . _passthrough_ts , sgv1_ . _passthrough_ts ) = ( sgv1_ . _passthrough_ts , sgv0_ . _passthrough_ts ) elif a2b : sgv1_ . _input_ts = sgv0_ . _input_ts [ : ] sgv1_ . _passthrough_ts = sgv0_ . _passthrough_ts [ : ] elif b2a : sgv0_ . _input_ts = sgv1_ . _input_ts [ : ] sgv0_ . _passthrough_ts = sgv1_ . _passthrough_ts [ : ] # pylint: enable=protected-access # Update the passthrough outputs as well. def update_passthrough_outputs ( a , b ) : # pylint: disable=protected-access for i , t in enumerate ( b . _output_ts ) : if t in a . _passthrough_ts : ii = a . _input_ts . index ( t ) b . _output_ts [ i ] = b . _input_ts [ ii ] # pylint: enable=protected-access if a2b : update_passthrough_outputs ( sgv0_ , sgv1_ ) if b2a : update_passthrough_outputs ( sgv1_ , sgv0_ ) # in-place # pylint: disable=protected-access sgv0 . _assign_from ( sgv0_ ) sgv1 . _assign_from ( sgv1_ )