Imported Upstream version 1.25.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/IR/AttrMirrorPadMode.h>
23 #include <luci_interpreter/core/DataType.h>
24
25 #include <cstdint>
26 #include <vector>
27
28 namespace luci_interpreter
29 {
30
31 // Inject commonly used types into `luci_interpreter` namespace for convenience.
32 using Activation = luci::FusedActFunc;
33 using Padding = luci::Padding;
34 using MirrorPadMode = luci::MirrorPadMode;
35
36 struct AddParams
37 {
38   Activation activation;
39 };
40
41 struct ArgMaxParams
42 {
43   DataType output_type;
44 };
45
46 struct BatchMatMulParams
47 {
48   bool adj_x;
49   bool adj_y;
50 };
51
52 struct ConcatenationParams
53 {
54   int axis;
55   Activation activation;
56 };
57
58 struct Conv2DParams
59 {
60   Padding padding;
61   int32_t stride_height;
62   int32_t stride_width;
63   int32_t dilation_height_factor;
64   int32_t dilation_width_factor;
65   Activation activation;
66 };
67
68 struct DepthToSpaceParams
69 {
70   int block_size;
71 };
72
73 struct DepthwiseConv2DParams
74 {
75   Padding padding;
76   int32_t depth_multiplier; // TODO Remove, as it can be calculated.
77   int32_t stride_height;
78   int32_t stride_width;
79   int32_t dilation_height_factor;
80   int32_t dilation_width_factor;
81   Activation activation;
82 };
83
84 struct DivParams
85 {
86   Activation activation;
87 };
88
89 struct FullyConnectedParams
90 {
91   Activation activation;
92   bool keep_num_dims = false;
93 };
94
95 struct GatherParams
96 {
97   int32_t axis;
98   int32_t batch_dims;
99 };
100
101 struct GeluParams
102 {
103   bool approximate;
104 };
105
106 struct InstanceNormParams
107 {
108   float epsilon;
109   Activation activation;
110 };
111
112 struct L2NormParams
113 {
114   Activation activation;
115 };
116
117 struct LeakyReluParams
118 {
119   float alpha;
120 };
121
122 struct LocalResponseNormalizationParams
123 {
124   int32_t radius;
125   float bias;
126   float alpha;
127   float beta;
128 };
129
130 struct MirrorPadParams
131 {
132   MirrorPadMode mode;
133 };
134
135 struct MulParams
136 {
137   Activation activation;
138 };
139
140 struct OneHotParams
141 {
142   int32_t axis;
143 };
144
145 struct PackParams
146 {
147   int32_t values_count;
148   int32_t axis;
149 };
150
151 struct Pool2DParams
152 {
153   Padding padding;
154   int32_t filter_height;
155   int32_t filter_width;
156   int32_t stride_height;
157   int32_t stride_width;
158   Activation activation;
159 };
160
161 struct ReducerParams
162 {
163   bool keep_dims;
164 };
165
166 struct ResizeBilinearParams
167 {
168   bool align_corners;
169   bool half_pixel_centers;
170 };
171
172 struct ResizeNearestNeighborParams
173 {
174   bool align_corners;
175   bool half_pixel_centers;
176 };
177
178 struct ShapeParams
179 {
180   loco::DataType out_type;
181 };
182
183 struct SubParams
184 {
185   Activation activation;
186 };
187
188 struct SVDFParams
189 {
190   bool asymmetric_quantize_inputs;
191   int32_t svdf_rank;
192   Activation activation;
193 };
194
195 struct SpaceToDepthParams
196 {
197   int block_size;
198 };
199
200 struct SoftmaxParams
201 {
202   float beta;
203 };
204
205 struct StridedSliceParams
206 {
207   int32_t begin_mask;
208   int32_t end_mask;
209   int32_t ellipsis_mask;
210   int32_t new_axis_mask;
211   int32_t shrink_axis_mask;
212 };
213
214 struct SqueezeParams
215 {
216   std::vector<int32_t> squeeze_dims;
217 };
218
219 struct TransposeConvParams
220 {
221   Padding padding;
222   int32_t stride_height;
223   int32_t stride_width;
224   Activation activation;
225 };
226
227 struct UnidirectionalSequenceLSTMParams
228 {
229   Activation activation;
230   float cell_clip;
231   float proj_clip;
232   bool time_major;
233   bool asymmetric_quantize_inputs;
234 };
235
236 struct UnpackParams
237 {
238   int axis;
239 };
240
241 } // namespace luci_interpreter
242
243 #endif // LUCI_INTERPRETER_CORE_KERNELPARAMS_H