TrainingExtensions/torch/src/python/aimet_torch/meta/connectedgraph.py
def _add_consumers_to_split_op_product(self, preceding_op: Op, split_op_product: Product):
        """
        A Split Op's output product has multiple consumers. Add them to the product.
        :param preceding_op: Op prior to split op
        :param split_op_product: Output product of split op
        """

        dotted_name = preceding_op.dotted_name
        output_product_names = self.get_product_names_from_dotted_name(dotted_name)

        # Important Notes
        # ResNet model uses the same Relu twice in the forward function of ResNet's BasicBlock.
        # The first Relu feeds in to the BasicBlock's Conv2.
        # The second Relu's output is split with one branch feeding the next BasicBlock's conv1 and the other
        # branch feeding in to the next BasicBlock's Add.
        # The following line filters out the Relu whose output is NOT split :(
        out_product_names = [name for name in output_product_names if preceding_op.name in name]

        num_products = len(out_product_names)
        consumer_index = 0
        for a_product_index in range(num_products):
            a_product = self.get_product(out_product_names[a_product_index])
            a_consumer = a_product.consumers[0]
            split_op_product.consumers.append(a_consumer)
            logger.debug("Insert Split Op: Step 2a. Consumer Op: %s, a_product_index: %s",
                         a_consumer.dotted_name, a_product_index)
            # Need to insert the newly created split_op product in the correct input index of the op
            logger.debug("Insert Split Op: Step 2b. Op has multiple input products: %s", a_consumer.inputs)
            input_product_index = determine_preceding_op_input_product_index_in_multi_input_op(preceding_op,
                                                                                               a_consumer)
            a_consumer.inputs[input_product_index] = split_op_product
            logger.debug("Insert Split Op: Step 2c. For product: %s, split_op input_product_index: %s",
                         split_op_product.name, input_product_index)
            consumer_index += 1

        A Split Op's output product has multiple consumers. Add them to the product.
        :param preceding_op: Op prior to split op
        :param split_op_product: Output product of split op
        
A Split Op's output product has multiple consumers. Add them to the product.
A Split Op ' s output product has multiple consumers . Add them to the product .
def _add_consumers_to_split_op_product(self, preceding_op: Op, split_op_product: Product):
        dotted_name = preceding_op.dotted_name
        output_product_names = self.get_product_names_from_dotted_name(dotted_name)
        out_product_names = [name for name in output_product_names if preceding_op.name in name]
        num_products = len(out_product_names)
        consumer_index = 0
        for a_product_index in range(num_products):
            a_product = self.get_product(out_product_names[a_product_index])
            a_consumer = a_product.consumers[0]
            split_op_product.consumers.append(a_consumer)
            logger.debug("Insert Split Op: Step 2a. Consumer Op: %s, a_product_index: %s",
                         a_consumer.dotted_name, a_product_index)
            logger.debug("Insert Split Op: Step 2b. Op has multiple input products: %s", a_consumer.inputs)
            input_product_index = determine_preceding_op_input_product_index_in_multi_input_op(preceding_op,
                                                                                               a_consumer)
            a_consumer.inputs[input_product_index] = split_op_product
            logger.debug("Insert Split Op: Step 2c. For product: %s, split_op input_product_index: %s",
                         split_op_product.name, input_product_index)
            consumer_index += 1
def _add_consumers_to_split_op_product ( self , preceding_op : Op , split_op_product : Product ) : dotted_name = preceding_op . dotted_name output_product_names = self . get_product_names_from_dotted_name ( dotted_name ) out_product_names = [ name for name in output_product_names if preceding_op . name in name ] num_products = len ( out_product_names ) consumer_index = 0 for a_product_index in range ( num_products ) : a_product = self . get_product ( out_product_names [ a_product_index ] ) a_consumer = a_product . consumers [ 0 ] split_op_product . consumers . append ( a_consumer ) logger . debug ( "Insert Split Op: Step 2a. Consumer Op: %s, a_product_index: %s" , a_consumer . dotted_name , a_product_index ) logger . debug ( "Insert Split Op: Step 2b. Op has multiple input products: %s" , a_consumer . inputs ) input_product_index = determine_preceding_op_input_product_index_in_multi_input_op ( preceding_op , a_consumer ) a_consumer . inputs [ input_product_index ] = split_op_product logger . debug ( "Insert Split Op: Step 2c. For product: %s, split_op input_product_index: %s" , split_op_product . name , input_product_index ) consumer_index += 1
A Split Op's output product has multiple consumers.
A Split Op ' s output product has multiple consumers .
"""
        A Split Op's output product has multiple consumers. Add them to the product.
        :param preceding_op: Op prior to split op
        :param split_op_product: Output product of split op
        """ # Important Notes # ResNet model uses the same Relu twice in the forward function of ResNet's BasicBlock. # The first Relu feeds in to the BasicBlock's Conv2. # The second Relu's output is split with one branch feeding the next BasicBlock's conv1 and the other # branch feeding in to the next BasicBlock's Add. # The following line filters out the Relu whose output is NOT split :( # Need to insert the newly created split_op product in the correct input index of the op
self
preceding_op
Op
Op prior to split op
Op prior to split op
split_op_product
Product
Output product of split op
Output product of split op