TrainingExtensions/torch/src/python/aimet_torch/meta/connectedgraph.py
def _handle_tuple_and_list_construct_ir_node(ir_node: IrNode, connections_to_ir_nodes_dict: ConnectionsToIrDictType):
    """
    Update connections of tuple and list construct ir_nodes, as well as connections to children of the ir_node.
    :param ir_node: Tuple or list construct ir_node
    :param connections_to_ir_nodes_dict: Dictionary mapping connections to input ir_node and output ir_nodes
    """
    # Identify the output connection and consumers of that connection
    assert len(ir_node.outputs) == 1
    output = ir_node.outputs[0]
    consumers = connections_to_ir_nodes_dict[output][1]

    # For each consumer, update their inputs by replacing the connection from Tuple/ListConstruct to the inputs
    # of Tuple/ListConstruct instead
    for consumer in consumers:
        connection_index = consumer.inputs.index(output)
        consumer.inputs[connection_index] = ir_node.inputs

    # Replace the output connection of Tuple/ListConstruct with its input connections
    ir_node.outputs[0] = ir_node.inputs
    del connections_to_ir_nodes_dict[output]

    Update connections of tuple and list construct ir_nodes, as well as connections to children of the ir_node.
    :param ir_node: Tuple or list construct ir_node
    :param connections_to_ir_nodes_dict: Dictionary mapping connections to input ir_node and output ir_nodes
    
Update connections of tuple and list construct ir_nodes, as well as connections to children of the ir_node.
Update connections of tuple and list construct ir_nodes as well as connections to children of the ir_node .
def _handle_tuple_and_list_construct_ir_node(ir_node: IrNode, connections_to_ir_nodes_dict: ConnectionsToIrDictType):
    assert len(ir_node.outputs) == 1
    output = ir_node.outputs[0]
    consumers = connections_to_ir_nodes_dict[output][1]
    for consumer in consumers:
        connection_index = consumer.inputs.index(output)
        consumer.inputs[connection_index] = ir_node.inputs
    ir_node.outputs[0] = ir_node.inputs
    del connections_to_ir_nodes_dict[output]
def _handle_tuple_and_list_construct_ir_node ( ir_node : IrNode , connections_to_ir_nodes_dict : ConnectionsToIrDictType ) : assert len ( ir_node . outputs ) == 1 output = ir_node . outputs [ 0 ] consumers = connections_to_ir_nodes_dict [ output ] [ 1 ] for consumer in consumers : connection_index = consumer . inputs . index ( output ) consumer . inputs [ connection_index ] = ir_node . inputs ir_node . outputs [ 0 ] = ir_node . inputs del connections_to_ir_nodes_dict [ output ]
Update connections of tuple and list construct ir_nodes, as well as connections to children of the ir_node.
Update connections of tuple and list construct ir_nodes as well as connections to children of the ir_node .
"""
    Update connections of tuple and list construct ir_nodes, as well as connections to children of the ir_node.
    :param ir_node: Tuple or list construct ir_node
    :param connections_to_ir_nodes_dict: Dictionary mapping connections to input ir_node and output ir_nodes
    """ # Identify the output connection and consumers of that connection # For each consumer, update their inputs by replacing the connection from Tuple/ListConstruct to the inputs # of Tuple/ListConstruct instead # Replace the output connection of Tuple/ListConstruct with its input connections
ir_node
IrNode
Tuple or list construct ir_node
Tuple or list construct ir_node
connections_to_ir_nodes_dict
ConnectionsToIrDictType
Dictionary mapping connections to input ir_node and output ir_nodes
Dictionary mapping connections to input ir_node and output ir_nodes