File tree Expand file tree Collapse file tree 3 files changed +390
-189
lines changed Expand file tree Collapse file tree 3 files changed +390
-189
lines changed Original file line number Diff line number Diff line change @@ -388,6 +388,7 @@ python_unittest(
388388 "//caffe2:torch",
389389 "//executorch/backends/cadence/aot:compiler",
390390 "//executorch/backends/cadence/aot:fuse_ops",
391+ "//executorch/backends/cadence/aot:graph_builder",
391392 "//executorch/backends/cadence/aot:ops_registrations",
392393 "//executorch/backends/cadence/aot:pass_utils",
393394 "//executorch/backends/cadence/aot:reorder_ops",
Original file line number Diff line number Diff line change @@ -144,6 +144,19 @@ def nodes_not_connected_in_gm(
144144 return True
145145
146146
147+ # Returns the position of the first entry of a node of a given kind in the graph.
148+ def get_node_pos (
149+ graph_module : torch .fx .GraphModule ,
150+ target : torch .fx .Node ,
151+ ) -> int :
152+ pos = 0
153+ for node in graph_module .graph .nodes :
154+ if node .target == target :
155+ return pos
156+ pos += 1
157+ return - 1
158+
159+
147160# Returns true if there is no instance of a node with target succ_target
148161# positioned immediately after a node with target pred_target in the graph
149162def nodes_not_adjacent_in_gm (
You can’t perform that action at this time.
0 commit comments