File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ # Copyright 2024-2025 Arm Limited and/or its affiliates.
2+ #
3+ # This source code is licensed under the BSD-style license found in the
4+ # LICENSE file in the root directory of this source tree.
5+
6+ # pyre-unsafe
7+ from typing import Any , List
8+
9+ import torch
10+
11+ from executorch .backends .arm .operators .node_visitor import (
12+ NodeVisitor ,
13+ register_node_visitor ,
14+ )
15+ from executorch .backends .arm .operators .operator_validation_utils import (
16+ validate_num_inputs ,
17+ )
18+ from executorch .backends .arm .tosa_mapping import TosaArg
19+
20+
21+ @register_node_visitor
22+ class CloneDimOrderVisitor (NodeVisitor ):
23+ """
24+ Implement _clone_dim_order as an identity operation.
25+ """
26+
27+ target = "dim_order_ops._clone_dim_order.default"
28+
29+ tosa_specs = NodeVisitor .tosa_specs
30+
31+ def define_node (
32+ self ,
33+ node : torch .fx .Node ,
34+ tosa_graph : Any ,
35+ inputs : List [TosaArg ],
36+ output : TosaArg ,
37+ ) -> None :
38+ import serializer .tosa_serializer as ts # type: ignore
39+
40+ validate_num_inputs (self .target , inputs , 1 )
41+
42+ # Since only contiguous dim order is currently supported, treat clone as an identity op.
43+ tosa_graph .addOperator (ts .TosaOp .Op ().IDENTITY , [inputs [0 ].name ], [output .name ])
You can’t perform that action at this time.
0 commit comments