File tree 3 files changed +390
-189
lines changed 3 files changed +390
-189
lines changed Original file line number Diff line number Diff line change @@ -388,6 +388,7 @@ python_unittest(
388
388
"//caffe2:torch",
389
389
"//executorch/backends/cadence/aot:compiler",
390
390
"//executorch/backends/cadence/aot:fuse_ops",
391
+ "//executorch/backends/cadence/aot:graph_builder",
391
392
"//executorch/backends/cadence/aot:ops_registrations",
392
393
"//executorch/backends/cadence/aot:pass_utils",
393
394
"//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(
144
144
return True
145
145
146
146
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
+
147
160
# Returns true if there is no instance of a node with target succ_target
148
161
# positioned immediately after a node with target pred_target in the graph
149
162
def nodes_not_adjacent_in_gm (
You can’t perform that action at this time.
0 commit comments