File tree 3 files changed +23
-0
lines changed
3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 32
32
CompileSpec ,
33
33
PreprocessResult ,
34
34
)
35
+
36
+ from executorch .exir .passes .memory_format_ops_pass import DimOrderOpsRevertPass
35
37
from torch .export .exported_program import ExportedProgram
36
38
37
39
FORMAT = "[%(levelname)s %(asctime)s %(filename)s:%(lineno)s] %(message)s"
@@ -83,6 +85,9 @@ def preprocess(
83
85
# FlatBuffer graph, process the `output` nodes and add their id to
84
86
# the `output_ids` array in the schema.
85
87
88
+ # TODO: Remove this once we have a better support for the dim-order ops.
89
+ edge_program = DimOrderOpsRevertPass ()(edge_program )
90
+
86
91
mps_graph = MPSGraph (
87
92
version = "0" ,
88
93
mps_nodes = [],
Original file line number Diff line number Diff line change @@ -78,6 +78,15 @@ def define_node(
78
78
)
79
79
)
80
80
81
+ @register_node_visitor
82
+ class ToDimOrderEmptyVisitor (NodeVisitor ):
83
+ target = ["exir_ops.edge.dim_order_ops._to_dim_order_copy.default" ]
84
+
85
+ def __init__ (self , * args ) -> None :
86
+ # We should never get here, because DimOrderOpsRevertPass replaces this with an aten.empty.memory_format op
87
+ # But if we do, we can't handle it ATM, so raise an exception
88
+ raise NotImplementedError ("exir_ops.edge.dim_order_ops._to_dim_order_copy.default is not supported yet" )
89
+
81
90
82
91
@register_node_visitor
83
92
class FullLikeVisitor (NodeVisitor ):
Original file line number Diff line number Diff line change @@ -33,3 +33,12 @@ def define_node(
33
33
)
34
34
input_id = self .define_tensor (get_input_node (node , 0 ), mps_graph )
35
35
self .tensor_to_id [node ] = input_id
36
+
37
+ @register_node_visitor
38
+ class ToDimOrderCopyVisitor (NodeVisitor ):
39
+ target = ["exir_ops.edge.dim_order_ops._to_dim_order_copy.default" ]
40
+
41
+ def __init__ (self , * args ) -> None :
42
+ # We should never get here, because DimOrderOpsRevertPass replaces this with an aten._to_copy op
43
+ # But if we do, we can't handle it ATM, so raise an exception
44
+ raise NotImplementedError ("exir_ops.edge.dim_order_ops._to_dim_order_copy.default is not supported yet" )
You can’t perform that action at this time.
0 commit comments