MCPcopy Create free account
hub / github.com/pytorch/executorch / call_submodule

Method call_submodule

exir/pass_base.py:626–648  ·  view source on GitHub ↗
(
        self, graph_module: fx.GraphModule, inputs: Tuple[Argument, ...]
    )

Source from the content-addressed store, hash-verified

624 return self._fx("output", "output", (results,), {}, meta)
625
626 def call_submodule(
627 self, graph_module: fx.GraphModule, inputs: Tuple[Argument, ...]
628 ) -> PassResult:
629 prev_tracer, self.tracer = self.tracer, self.ExportTracer(
630 self, graph_module.graph._codegen
631 )
632 self.tracer.fake_tensor_mode = prev_tracer.fake_tensor_mode
633 interpreter = self.ExportInterpreter(self, graph_module)
634 prev_interpreter, self.interpreter = self.interpreter, torch.fx.Interpreter(
635 torch.fx.GraphModule(torch.nn.Module(), torch.fx.Graph())
636 )
637 inputs_data = pytree.tree_map_only(ProxyValue, lambda x: x.data, inputs)
638 with fx_traceback.preserve_node_meta():
639 interpreter.run(*inputs_data)
640
641 new_graph_module = torch.fx.GraphModule(self.tracer.root, self.tracer.graph)
642
643 self.tracer = prev_tracer
644 self.interpreter = prev_interpreter
645 return PassResult(
646 new_graph_module,
647 True,
648 )
649
650 def call(self, graph_module: fx.GraphModule) -> PassResult:
651 if not getattr(self, "_initialized", False):

Callers 5

call_condMethod · 0.95
call_whileMethod · 0.95
call_mapMethod · 0.95
call_scanMethod · 0.95
callMethod · 0.95

Calls 2

ModuleMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected