TrainingExtensions/torch/src/python/aimet_torch/meta/connectedgraph.py
def _create_ops_from_ir_nodes_list(self, ir_nodes_list: List[IrNode],
                                       module_tensor_shapes_map: ModuleTensorShapeMapType)\
            -> Dict[IrNode, Op]:
        """
        Given a list of nodes, create ops for each one.
        :param ir_nodes_list: List of nodes to create ops for
        :param module_tensor_shapes_map: Dictionary mapping modules to input and output tensor shapes obtained from a
            forward pass
        :return: Dictionary mapping nodes to corresponding ops that were created
        """
        node_to_op_dict = {}
        for idx, node in enumerate(ir_nodes_list):
            op_name = node.node_type + '_' + str(idx)
            op = Op(name=op_name, dotted_name=op_name, output_shape=None, is_anonymous=node.module is None,
                    op_type=node.node_type)
            if node.module is not None:
                op.model_module = PytorchModelModule(node.module)
                if node.module in module_tensor_shapes_map:
                    _, output_tensor_shapes = module_tensor_shapes_map[node.module]
                    # Temporarily not handling dict types for output tensors.
                    if isinstance(output_tensor_shapes, Dict):
                        output_tensor_shapes = None
                    # For now, treat only the first output shape as the shape of the node if there is more than one
                    # entry
                    flattened_shapes = _flatten_lists(output_tensor_shapes)
                    op.output_shape = flattened_shapes[0]
                op.dotted_name = self._module_to_name[node.module]
                _fill_groups_info(op, node.module)
            node_to_op_dict[node] = op
            self._ops[op_name] = op
            self.ordered_ops.append(op)
        return node_to_op_dict

        Given a list of nodes, create ops for each one.
        :param ir_nodes_list: List of nodes to create ops for
        :param module_tensor_shapes_map: Dictionary mapping modules to input and output tensor shapes obtained from a
            forward pass
        :return: Dictionary mapping nodes to corresponding ops that were created
        
Given a list of nodes, create ops for each one.
Given a list of nodes create ops for each one .
def _create_ops_from_ir_nodes_list(self, ir_nodes_list: List[IrNode],
                                       module_tensor_shapes_map: ModuleTensorShapeMapType)\
            -> Dict[IrNode, Op]:
        node_to_op_dict = {}
        for idx, node in enumerate(ir_nodes_list):
            op_name = node.node_type + '_' + str(idx)
            op = Op(name=op_name, dotted_name=op_name, output_shape=None, is_anonymous=node.module is None,
                    op_type=node.node_type)
            if node.module is not None:
                op.model_module = PytorchModelModule(node.module)
                if node.module in module_tensor_shapes_map:
                    _, output_tensor_shapes = module_tensor_shapes_map[node.module]
                    if isinstance(output_tensor_shapes, Dict):
                        output_tensor_shapes = None
                    flattened_shapes = _flatten_lists(output_tensor_shapes)
                    op.output_shape = flattened_shapes[0]
                op.dotted_name = self._module_to_name[node.module]
                _fill_groups_info(op, node.module)
            node_to_op_dict[node] = op
            self._ops[op_name] = op
            self.ordered_ops.append(op)
        return node_to_op_dict
def _create_ops_from_ir_nodes_list ( self , ir_nodes_list : List [ IrNode ] , module_tensor_shapes_map : ModuleTensorShapeMapType ) -> Dict [ IrNode , Op ] : node_to_op_dict = { } for idx , node in enumerate ( ir_nodes_list ) : op_name = node . node_type + '_' + str ( idx ) op = Op ( name = op_name , dotted_name = op_name , output_shape = None , is_anonymous = node . module is None , op_type = node . node_type ) if node . module is not None : op . model_module = PytorchModelModule ( node . module ) if node . module in module_tensor_shapes_map : _ , output_tensor_shapes = module_tensor_shapes_map [ node . module ] if isinstance ( output_tensor_shapes , Dict ) : output_tensor_shapes = None flattened_shapes = _flatten_lists ( output_tensor_shapes ) op . output_shape = flattened_shapes [ 0 ] op . dotted_name = self . _module_to_name [ node . module ] _fill_groups_info ( op , node . module ) node_to_op_dict [ node ] = op self . _ops [ op_name ] = op self . ordered_ops . append ( op ) return node_to_op_dict
Given a list of nodes, create ops for each one.
Given a list of nodes create ops for each one .
"""
        Given a list of nodes, create ops for each one.
        :param ir_nodes_list: List of nodes to create ops for
        :param module_tensor_shapes_map: Dictionary mapping modules to input and output tensor shapes obtained from a
            forward pass
        :return: Dictionary mapping nodes to corresponding ops that were created
        """ # Temporarily not handling dict types for output tensors. # For now, treat only the first output shape as the shape of the node if there is more than one # entry
Dictionary mapping nodes to corresponding ops that were created
Dictionary mapping nodes to corresponding ops that were created
self
ir_nodes_list
List[IrNode]
List of nodes to create ops for
List of nodes to create ops for
module_tensor_shapes_map
ModuleTensorShapeMapType
Dictionary mapping modules to input and output tensor shapes obtained from a
forward pass
Dictionary mapping modules to input and output tensor shapes obtained from a forward pass