Returns a list of submodules used for scan operations (torch.ops.higher_order.scan) that are in the given toplevel graph (does not look into submodules). Specifically, the returned value is a list containing tuples of (name of the submodule that's stored in the graph module, the
(
graph_module: torch.fx.GraphModule,
)
| 113 | |
| 114 | |
| 115 | def get_scan_submodules( |
| 116 | graph_module: torch.fx.GraphModule, |
| 117 | ) -> List[Tuple[str, torch.fx.GraphModule, torch.fx.Node]]: |
| 118 | """ |
| 119 | Returns a list of submodules used for scan operations |
| 120 | (torch.ops.higher_order.scan) that are in the given toplevel graph (does not look |
| 121 | into submodules). Specifically, the returned value is a list containing |
| 122 | tuples of (name of the submodule that's stored in the graph module, the |
| 123 | submodule itself, and the fx node that uses this submodule). |
| 124 | |
| 125 | For scan, the combine_fn submodule is at argument index 0. |
| 126 | The scan operator signature is: scan(combine_fn, init, xs, additional_inputs) |
| 127 | """ |
| 128 | return _get_control_flow_submodules( |
| 129 | graph_module, |
| 130 | { |
| 131 | torch.ops.higher_order.scan: [0], |
| 132 | }, |
| 133 | ) |
| 134 | |
| 135 | |
| 136 | def bfs_trace_with_node_process( |
nothing calls this directly
no test coverage detected