Imported Upstream version 1.4.0
[platform/core/ml/nnfw.git] / runtime / onert / backend / cpu / ShapeFixer.h
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __ONERT_BACKEND_CPU_SHAPE_FIXER_H__
18 #define __ONERT_BACKEND_CPU_SHAPE_FIXER_H__
19
20 #include "TensorBuilder.h"
21 #include "operand/Tensor.h"
22
23 #include <backend/IShapeFixer.h>
24 #include <ir/Operands.h>
25
26 namespace onert
27 {
28 namespace backend
29 {
30 namespace cpu
31 {
32
33 class ShapeFixer : public IShapeFixer
34 {
35 public:
36   ShapeFixer(const ir::Operands &ctx);
37
38   void visit(const ir::operation::Comparison &) override;
39   void visit(const ir::operation::Conv2D &) override;
40   void visit(const ir::operation::DepthwiseConv2D &) override;
41   void visit(const ir::operation::MaxPool2D &) override;
42   void visit(const ir::operation::AvgPool2D &) override;
43   void visit(const ir::operation::Concat &) override;
44   void visit(const ir::operation::FullyConnected &) override;
45   void visit(const ir::operation::Reshape &) override;
46   void visit(const ir::operation::Squeeze &) override;
47   void visit(const ir::operation::Softmax &) override;
48   void visit(const ir::operation::Add &) override;
49   void visit(const ir::operation::Gather &) override;
50   void visit(const ir::operation::Sub &) override;
51   void visit(const ir::operation::Mul &) override;
52   void visit(const ir::operation::Div &) override;
53   void visit(const ir::operation::Permute &) override;
54   void visit(const ir::operation::Custom &) override;
55   void visit(const ir::operation::Exp &) override;
56   void visit(const ir::operation::Logistic &) override;
57   void visit(const ir::operation::Pad &) override;
58   void visit(const ir::operation::Max &) override;
59   void visit(const ir::operation::Min &) override;
60   void visit(const ir::operation::Tanh &) override;
61   void visit(const ir::operation::Pack &) override;
62   void visit(const ir::operation::Unpack &) override;
63   void visit(const ir::operation::OneHot &) override;
64   void visit(const ir::operation::Cast &) override;
65   void visit(const ir::operation::Transpose &) override;
66   void visit(const ir::operation::ReduceSum &) override;
67   void visit(const ir::operation::ReduceMax &) override;
68   void visit(const ir::operation::ReduceMin &) override;
69   void visit(const ir::operation::Slice &) override;
70   void visit(const ir::operation::StridedSlice &) override;
71   void visit(const ir::operation::Split &) override;
72   void visit(const ir::operation::Abs &) override;
73   void visit(const ir::operation::Sin &) override;
74   void visit(const ir::operation::RSQRT &) override;
75   void visit(const ir::operation::Shape &) override;
76
77 private:
78   const ir::Operands &_ctx;
79 };
80
81 } // namespace cpu
82 } // namespace backend
83 } // namespace onert
84
85 #endif // __ONERT_BACKEND_CPU_SHAPE_FIXER_H__