TrainingExtensions/torch/src/python/aimet_torch/model_preparer.py
def _create_node_for_new_module(symbolic_traced_model: torch.fx.GraphModule, node: torch.fx.node,
                                module_name: str):
    """
    Insert 'call module' node into graph and replace all the uses of 'node' with newly added node and erase the
    the old node from graph.
    :param symbolic_traced_model: Symbolically traced model
    :param node: Current node in the graph after which new node will be inserted
    :param module_name: Qualified module name in symbolic_traced_model hierarchy corresponding to new node
    :return: None
    """
    with symbolic_traced_model.graph.inserting_after(node):
        new_node = symbolic_traced_model.graph.call_module(module_name, args=node.args)
        node.replace_all_uses_with(new_node)
    symbolic_traced_model.graph.erase_node(node)

    Insert 'call module' node into graph and replace all the uses of 'node' with newly added node and erase the
    the old node from graph.
    :param symbolic_traced_model: Symbolically traced model
    :param node: Current node in the graph after which new node will be inserted
    :param module_name: Qualified module name in symbolic_traced_model hierarchy corresponding to new node
    :return: None
    
Insert 'call module' node into graph and replace all the uses of 'node' with newly added node and erase the
the old node from graph.
Insert ' call module ' node into graph and replace all the uses of ' node ' with newly added node and erase the the old node from graph .
def _create_node_for_new_module(symbolic_traced_model: torch.fx.GraphModule, node: torch.fx.node,
                                module_name: str):
    with symbolic_traced_model.graph.inserting_after(node):
        new_node = symbolic_traced_model.graph.call_module(module_name, args=node.args)
        node.replace_all_uses_with(new_node)
    symbolic_traced_model.graph.erase_node(node)
def _create_node_for_new_module ( symbolic_traced_model : torch . fx . GraphModule , node : torch . fx . node , module_name : str ) : with symbolic_traced_model . graph . inserting_after ( node ) : new_node = symbolic_traced_model . graph . call_module ( module_name , args = node . args ) node . replace_all_uses_with ( new_node ) symbolic_traced_model . graph . erase_node ( node )
Insert 'call module' node into graph and replace all the uses of 'node' with newly added node and erase the
the old node from graph.
Insert ' call module ' node into graph and replace all the uses of ' node ' with newly added node and erase the the old node from graph .
"""
    Insert 'call module' node into graph and replace all the uses of 'node' with newly added node and erase the
    the old node from graph.
    :param symbolic_traced_model: Symbolically traced model
    :param node: Current node in the graph after which new node will be inserted
    :param module_name: Qualified module name in symbolic_traced_model hierarchy corresponding to new node
    :return: None
    """
None
symbolic_traced_model
torch.fx.GraphModule
Symbolically traced model
Symbolically traced model
node
torch.fx.node
Current node in the graph after which new node will be inserted
Current node in the graph after which new node will be inserted
module_name
str
Qualified module name in symbolic_traced_model hierarchy corresponding to new node
Qualified module name in symbolic_traced_model hierarchy corresponding to new node