Returns a list of lowered modules that are in the given graph (does not look into submodules). Specifically, the returned value is a list containing a tuple of (name of the lowered module that's stored in the graph module, the lowered module itself, and the fx node that called this
(
graph_module: torch.fx.GraphModule,
)
| 927 | |
| 928 | |
| 929 | def get_lowered_submodules( |
| 930 | graph_module: torch.fx.GraphModule, |
| 931 | ) -> List[Tuple[str, LoweredBackendModule, torch.fx.Node]]: |
| 932 | """ |
| 933 | Returns a list of lowered modules that are in the given graph (does not look |
| 934 | into submodules). Specifically, the returned value is a list containing a |
| 935 | tuple of (name of the lowered module that's stored in the graph module, the |
| 936 | lowered module itself, and the fx node that called this lowered module). |
| 937 | """ |
| 938 | lowered_submodules = [] |
| 939 | for node in graph_module.graph.nodes: |
| 940 | if node.op == "call_function" and node.target == executorch_call_delegate: |
| 941 | name, module, node = _get_submodule(graph_module, node, 0) |
| 942 | assert isinstance(module, LoweredBackendModule) |
| 943 | lowered_submodules.append((name, module, node)) |
| 944 | return lowered_submodules |
| 945 | |
| 946 | |
| 947 | def get_lowered_backend_modules( |