2 Copyright (c) 2018 Intel Corporation
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
17 from mo.front.extractor import FrontExtractorOp
18 from mo.ops.op import Op
19 from mo.ops.permute import Permute
21 from mo.front.onnx.extractors.utils import onnx_attr
24 class TransposeFrontExtractor(FrontExtractorOp):
30 # In case of undefined 'perm' attribute, Transpose operation in ONNX reverse the dimensions
31 order = onnx_attr(node, 'perm', 'ints', default=None)
33 'order': np.array(order, dtype=np.int64) if order is not None else None,
34 'reverse_order': order is None
37 # update the attributes of the node
38 Permute.update_node_stat(node, attrs)
39 return __class__.enabled