TrainingExtensions/tensorflow/src/python/aimet_tensorflow/common/connectedgraph.py
def _branch_ops_processing(self):
        """ Identify places in the op/product graph where branch ops need to be inserted, and create them """

        # Dictionary that will map producers (ops) to products
        # Ops that map to multiple products will be ones to create branch ops for
        product_producer_dict = dict()
        for product in self._products.values():
            if product.producer is not None:
                if product.producer not in product_producer_dict:
                    product_producer_dict[product.producer] = [product]
                else:
                    product_producer_dict[product.producer].append(product)

        for op in product_producer_dict:
            if len(product_producer_dict[op]) > 1:
                # check if this has an input node
                is_model_input = False
                for product in product_producer_dict[op]:
                    if product.is_model_input:
                        is_model_input = True
                # Create branch op directly under op
                branch_op = self._create_branch_op(op.output_shape)
                # Create product to link op and branch_op
                self._link_previous_op_to_branch_op(op, branch_op, op.output_shape)
                # Create product to link branch op with multiple children modules
                self._link_branch_op_to_multiple_ops(branch_op, product_producer_dict[op], is_model_input)
 Identify places in the op/product graph where branch ops need to be inserted, and create them 
Identify places in the op/product graph where branch ops need to be inserted, and create them
Identify places in the op / product graph where branch ops need to be inserted and create them
def _branch_ops_processing(self):
        product_producer_dict = dict()
        for product in self._products.values():
            if product.producer is not None:
                if product.producer not in product_producer_dict:
                    product_producer_dict[product.producer] = [product]
                else:
                    product_producer_dict[product.producer].append(product)
        for op in product_producer_dict:
            if len(product_producer_dict[op]) > 1:
                is_model_input = False
                for product in product_producer_dict[op]:
                    if product.is_model_input:
                        is_model_input = True
                branch_op = self._create_branch_op(op.output_shape)
                self._link_previous_op_to_branch_op(op, branch_op, op.output_shape)
                self._link_branch_op_to_multiple_ops(branch_op, product_producer_dict[op], is_model_input)
def _branch_ops_processing ( self ) : product_producer_dict = dict ( ) for product in self . _products . values ( ) : if product . producer is not None : if product . producer not in product_producer_dict : product_producer_dict [ product . producer ] = [ product ] else : product_producer_dict [ product . producer ] . append ( product ) for op in product_producer_dict : if len ( product_producer_dict [ op ] ) > 1 : is_model_input = False for product in product_producer_dict [ op ] : if product . is_model_input : is_model_input = True branch_op = self . _create_branch_op ( op . output_shape ) self . _link_previous_op_to_branch_op ( op , branch_op , op . output_shape ) self . _link_branch_op_to_multiple_ops ( branch_op , product_producer_dict [ op ] , is_model_input )
Identify places in the op/product graph where branch ops need to be inserted, and create them
Identify places in the op / product graph where branch ops need to be inserted and create them
""" Identify places in the op/product graph where branch ops need to be inserted, and create them """ # Dictionary that will map producers (ops) to products # Ops that map to multiple products will be ones to create branch ops for # check if this has an input node # Create branch op directly under op # Create product to link op and branch_op # Create product to link branch op with multiple children modules
self