TrainingExtensions/torch/src/python/aimet_torch/meta/connectedgraph.py
def _construct_graph(self, model: torch.nn.Module, model_input: Union[torch.Tensor, Tuple]):
        """
        Construct connected graph from model and example inputs.
        :param model: Pytorch model to create connected graph from
        :param model_input: Example input to model.  Can be a single tensor or a list/tuple of input tensors
        """
        module_tensor_shapes_map = ConnectedGraph._generate_module_tensor_shapes_lookup_table(model, model_input)
        trace = torch.jit.trace(model, model_input, check_trace=check_trace)
        ir_nodes_list, output_map = self._parse_top_level_trace(trace, model)
        self._construct_ops_and_products(ir_nodes_list,
                                         module_tensor_shapes_map,
                                         self.passthrough_graph_nodes,
                                         self.input_graph_nodes_to_ignore,
                                         output_map)

        # Create parameters for ops such as conv, batchnorm, etc.
        self._fill_op_params()

        # For each split in the model, insert a corresponding split Op in the connected graph.
        ops_list = [op for op in self._ops.values()]
        for op in ops_list:
            self._determine_split_behavior_for_op_and_insert_split_op_in_connected_graph(op)

        Construct connected graph from model and example inputs.
        :param model: Pytorch model to create connected graph from
        :param model_input: Example input to model.  Can be a single tensor or a list/tuple of input tensors
        
Construct connected graph from model and example inputs.
Construct connected graph from model and example inputs .
def _construct_graph(self, model: torch.nn.Module, model_input: Union[torch.Tensor, Tuple]):
        module_tensor_shapes_map = ConnectedGraph._generate_module_tensor_shapes_lookup_table(model, model_input)
        trace = torch.jit.trace(model, model_input, check_trace=check_trace)
        ir_nodes_list, output_map = self._parse_top_level_trace(trace, model)
        self._construct_ops_and_products(ir_nodes_list,
                                         module_tensor_shapes_map,
                                         self.passthrough_graph_nodes,
                                         self.input_graph_nodes_to_ignore,
                                         output_map)
        self._fill_op_params()
        ops_list = [op for op in self._ops.values()]
        for op in ops_list:
            self._determine_split_behavior_for_op_and_insert_split_op_in_connected_graph(op)
def _construct_graph ( self , model : torch . nn . Module , model_input : Union [ torch . Tensor , Tuple ] ) : module_tensor_shapes_map = ConnectedGraph . _generate_module_tensor_shapes_lookup_table ( model , model_input ) trace = torch . jit . trace ( model , model_input , check_trace = check_trace ) ir_nodes_list , output_map = self . _parse_top_level_trace ( trace , model ) self . _construct_ops_and_products ( ir_nodes_list , module_tensor_shapes_map , self . passthrough_graph_nodes , self . input_graph_nodes_to_ignore , output_map ) self . _fill_op_params ( ) ops_list = [ op for op in self . _ops . values ( ) ] for op in ops_list : self . _determine_split_behavior_for_op_and_insert_split_op_in_connected_graph ( op )
Construct connected graph from model and example inputs.
Construct connected graph from model and example inputs .
"""
        Construct connected graph from model and example inputs.
        :param model: Pytorch model to create connected graph from
        :param model_input: Example input to model.  Can be a single tensor or a list/tuple of input tensors
        """ # Create parameters for ops such as conv, batchnorm, etc. # For each split in the model, insert a corresponding split Op in the connected graph.
self
model
torch.nn.Module
Pytorch model to create connected graph from
Pytorch model to create connected graph from
model_input
Union[torch.Tensor, Tuple]
Example input to model.  Can be a single tensor or a list/tuple of input tensors
Example input to model . Can be a single tensor or a list / tuple of input tensors