TrainingExtensions/torch/src/python/aimet_torch/meta/connectedgraph.py
def _create_products_from_connections(self, connections_to_nodes_dict: ConnectionsToIrDictType,
                                          node_to_op_dict: Dict[IrNode, Op],
                                          output_map: Dict[torch._C.TensorType, torch._C.TensorType],
                                          input_types_to_ignore: List[str]):
        """
        Given connections in a dictionary, create products for each connection if it is not one to ignore.
        :param connections_to_nodes_dict: Dictionary mapping connections to input IrNode and output IrNodes
        :param node_to_op_dict: Dictionary mapping nodes to corresponding ops
        :param output_map: Mapping between higher level connections with corresponding lower level recursive
            connections. Only the base level connections carry shape information.
        :param input_types_to_ignore: Input node types to ignore (do not create products for output connections from
            these nodes)
        """
        for connection, (producer, consumer_list) in connections_to_nodes_dict.items():
            if producer is None:
                # Case of input connection to model
                assert consumer_list
                for consumer in consumer_list:
                    consumer_op = node_to_op_dict[consumer]
                    product_name = 'input_to_' + consumer_op.name
                    if product_name not in self._products:
                        product = _create_product_from_connection(product_name, connection, output_map)
                        product.is_model_input = True
                        product.add_consumer(consumer_op)
                        consumer_op.add_input(product)
                        self._products[product_name] = product
            elif producer.node_type in input_types_to_ignore:
                continue
            else:
                producer_op = node_to_op_dict[producer]
                for consumer in consumer_list:
                    consumer_op = node_to_op_dict[consumer]
                    product_name = producer_op.name + '_to_' + consumer_op.name
                    if product_name not in self._products:
                        product = _create_product_from_connection(product_name, connection, output_map)
                        product.producer = producer_op
                        self._products[product_name] = product
                    else:
                        product = self._products[product_name]
                    # If an op has multiple output products, only the first one will be listed as the op's output here
                    if producer_op.output is None:
                        _update_op_output_with_product(producer_op, product)
                    product.add_consumer(consumer_op)
                    consumer_op.add_input(product)

        Given connections in a dictionary, create products for each connection if it is not one to ignore.
        :param connections_to_nodes_dict: Dictionary mapping connections to input IrNode and output IrNodes
        :param node_to_op_dict: Dictionary mapping nodes to corresponding ops
        :param output_map: Mapping between higher level connections with corresponding lower level recursive
            connections. Only the base level connections carry shape information.
        :param input_types_to_ignore: Input node types to ignore (do not create products for output connections from
            these nodes)
        
Given connections in a dictionary, create products for each connection if it is not one to ignore.
Given connections in a dictionary create products for each connection if it is not one to ignore .
def _create_products_from_connections(self, connections_to_nodes_dict: ConnectionsToIrDictType,
                                          node_to_op_dict: Dict[IrNode, Op],
                                          output_map: Dict[torch._C.TensorType, torch._C.TensorType],
                                          input_types_to_ignore: List[str]):
        for connection, (producer, consumer_list) in connections_to_nodes_dict.items():
            if producer is None:
                assert consumer_list
                for consumer in consumer_list:
                    consumer_op = node_to_op_dict[consumer]
                    product_name = 'input_to_' + consumer_op.name
                    if product_name not in self._products:
                        product = _create_product_from_connection(product_name, connection, output_map)
                        product.is_model_input = True
                        product.add_consumer(consumer_op)
                        consumer_op.add_input(product)
                        self._products[product_name] = product
            elif producer.node_type in input_types_to_ignore:
                continue
            else:
                producer_op = node_to_op_dict[producer]
                for consumer in consumer_list:
                    consumer_op = node_to_op_dict[consumer]
                    product_name = producer_op.name + '_to_' + consumer_op.name
                    if product_name not in self._products:
                        product = _create_product_from_connection(product_name, connection, output_map)
                        product.producer = producer_op
                        self._products[product_name] = product
                    else:
                        product = self._products[product_name]
                    if producer_op.output is None:
                        _update_op_output_with_product(producer_op, product)
                    product.add_consumer(consumer_op)
                    consumer_op.add_input(product)
def _create_products_from_connections ( self , connections_to_nodes_dict : ConnectionsToIrDictType , node_to_op_dict : Dict [ IrNode , Op ] , output_map : Dict [ torch . _C . TensorType , torch . _C . TensorType ] , input_types_to_ignore : List [ str ] ) : for connection , ( producer , consumer_list ) in connections_to_nodes_dict . items ( ) : if producer is None : assert consumer_list for consumer in consumer_list : consumer_op = node_to_op_dict [ consumer ] product_name = 'input_to_' + consumer_op . name if product_name not in self . _products : product = _create_product_from_connection ( product_name , connection , output_map ) product . is_model_input = True product . add_consumer ( consumer_op ) consumer_op . add_input ( product ) self . _products [ product_name ] = product elif producer . node_type in input_types_to_ignore : continue else : producer_op = node_to_op_dict [ producer ] for consumer in consumer_list : consumer_op = node_to_op_dict [ consumer ] product_name = producer_op . name + '_to_' + consumer_op . name if product_name not in self . _products : product = _create_product_from_connection ( product_name , connection , output_map ) product . producer = producer_op self . _products [ product_name ] = product else : product = self . _products [ product_name ] if producer_op . output is None : _update_op_output_with_product ( producer_op , product ) product . add_consumer ( consumer_op ) consumer_op . add_input ( product )
Given connections in a dictionary, create products for each connection if it is not one to ignore.
Given connections in a dictionary create products for each connection if it is not one to ignore .
"""
        Given connections in a dictionary, create products for each connection if it is not one to ignore.
        :param connections_to_nodes_dict: Dictionary mapping connections to input IrNode and output IrNodes
        :param node_to_op_dict: Dictionary mapping nodes to corresponding ops
        :param output_map: Mapping between higher level connections with corresponding lower level recursive
            connections. Only the base level connections carry shape information.
        :param input_types_to_ignore: Input node types to ignore (do not create products for output connections from
            these nodes)
        """ # Case of input connection to model # If an op has multiple output products, only the first one will be listed as the op's output here
self
connections_to_nodes_dict
ConnectionsToIrDictType
Dictionary mapping connections to input IrNode and output IrNodes
Dictionary mapping connections to input IrNode and output IrNodes
node_to_op_dict
Dict[IrNode, Op]
Dictionary mapping nodes to corresponding ops
Dictionary mapping nodes to corresponding ops
output_map
Dict[torch._C.TensorType, torch._C.TensorType]
Mapping between higher level connections with corresponding lower level recursive
connections. Only the base level connections carry shape information.
Mapping between higher level connections with corresponding lower level recursive connections . Only the base level connections carry shape information .
input_types_to_ignore
List[str]
Input node types to ignore (do not create products for output connections from
these nodes)
Input node types to ignore ( do not create products for output connections from these nodes )