Imported Upstream version 1.8.0
[platform/core/ml/nnfw.git] / compiler / luci-interpreter / src / core / KernelParams.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 LUCI_INTERPRETER_CORE_KERNELPARAMS_H
18 #define LUCI_INTERPRETER_CORE_KERNELPARAMS_H
19
20 #include <luci/IR/AttrPadding.h>
21 #include <luci/IR/AttrFusedActFunc.h>
22 #include <luci_interpreter/core/DataType.h>
23
24 #include <cstdint>
25 #include <vector>
26
27 namespace luci_interpreter
28 {
29
30 // Inject commonly used types into `luci_interpreter` namespace for convenience.
31 using Activation = luci::FusedActFunc;
32 using Padding = luci::Padding;
33
34 struct AddParams
35 {
36   Activation activation;
37 };
38
39 struct ArgMaxParams
40 {
41   DataType output_type;
42 };
43
44 struct ConcatenationParams
45 {
46   int axis;
47 };
48
49 struct Conv2DParams
50 {
51   Padding padding;
52   int32_t stride_height;
53   int32_t stride_width;
54   int32_t dilation_height_factor;
55   int32_t dilation_width_factor;
56   Activation activation;
57 };
58
59 struct DepthToSpaceParams
60 {
61   int block_size;
62 };
63
64 struct DepthwiseConv2DParams
65 {
66   Padding padding;
67   int32_t depth_multiplier; // TODO Remove, as it can be calculated.
68   int32_t stride_height;
69   int32_t stride_width;
70   int32_t dilation_height_factor;
71   int32_t dilation_width_factor;
72   Activation activation;
73 };
74
75 struct FullyConnectedParams
76 {
77   Activation activation;
78 };
79
80 struct L2NormParams
81 {
82   Activation activation;
83 };
84
85 struct LeakyReluParams
86 {
87   float alpha;
88 };
89
90 struct LocalResponseNormalizationParams
91 {
92   int32_t radius;
93   float bias;
94   float alpha;
95   float beta;
96 };
97
98 struct MulParams
99 {
100   Activation activation;
101 };
102
103 struct Pool2DParams
104 {
105   Padding padding;
106   int32_t filter_height;
107   int32_t filter_width;
108   int32_t stride_height;
109   int32_t stride_width;
110   Activation activation;
111 };
112
113 struct ReducerParams
114 {
115   bool keep_dims;
116 };
117
118 struct SpaceToDepthParams
119 {
120   int block_size;
121 };
122
123 struct SoftmaxParams
124 {
125   float beta;
126 };
127
128 struct StridedSliceParams
129 {
130   int32_t begin_mask;
131   int32_t end_mask;
132   int32_t ellipsis_mask;
133   int32_t new_axis_mask;
134   int32_t shrink_axis_mask;
135 };
136
137 struct SqueezeParams
138 {
139   std::vector<int32_t> squeeze_dims;
140 };
141
142 struct TransposeConvParams
143 {
144   Padding padding;
145   int32_t stride_height;
146   int32_t stride_width;
147 };
148
149 struct UnpackParams
150 {
151   int axis;
152 };
153
154 } // namespace luci_interpreter
155
156 #endif // LUCI_INTERPRETER_CORE_KERNELPARAMS_H