45f3bfe0a4dce570aa5f412b36044b75f5aa5df1
[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 InstanceNormParams
102 {
103   float epsilon;
104   Activation activation;
105 };
106
107 struct L2NormParams
108 {
109   Activation activation;
110 };
111
112 struct LeakyReluParams
113 {
114   float alpha;
115 };
116
117 struct LocalResponseNormalizationParams
118 {
119   int32_t radius;
120   float bias;
121   float alpha;
122   float beta;
123 };
124
125 struct MirrorPadParams
126 {
127   MirrorPadMode mode;
128 };
129
130 struct MulParams
131 {
132   Activation activation;
133 };
134
135 struct OneHotParams
136 {
137   int32_t axis;
138 };
139
140 struct PackParams
141 {
142   int32_t values_count;
143   int32_t axis;
144 };
145
146 struct Pool2DParams
147 {
148   Padding padding;
149   int32_t filter_height;
150   int32_t filter_width;
151   int32_t stride_height;
152   int32_t stride_width;
153   Activation activation;
154 };
155
156 struct ReducerParams
157 {
158   bool keep_dims;
159 };
160
161 struct ResizeBilinearParams
162 {
163   bool align_corners;
164   bool half_pixel_centers;
165 };
166
167 struct ResizeNearestNeighborParams
168 {
169   bool align_corners;
170   bool half_pixel_centers;
171 };
172
173 struct ShapeParams
174 {
175   loco::DataType out_type;
176 };
177
178 struct SubParams
179 {
180   Activation activation;
181 };
182
183 struct SVDFParams
184 {
185   bool asymmetric_quantize_inputs;
186   int32_t svdf_rank;
187   Activation activation;
188 };
189
190 struct SpaceToDepthParams
191 {
192   int block_size;
193 };
194
195 struct SoftmaxParams
196 {
197   float beta;
198 };
199
200 struct StridedSliceParams
201 {
202   int32_t begin_mask;
203   int32_t end_mask;
204   int32_t ellipsis_mask;
205   int32_t new_axis_mask;
206   int32_t shrink_axis_mask;
207 };
208
209 struct SqueezeParams
210 {
211   std::vector<int32_t> squeeze_dims;
212 };
213
214 struct TransposeConvParams
215 {
216   Padding padding;
217   int32_t stride_height;
218   int32_t stride_width;
219 };
220
221 struct UnidirectionalSequenceLSTMParams
222 {
223   Activation activation;
224   float cell_clip;
225   float proj_clip;
226   bool time_major;
227   bool asymmetric_quantize_inputs;
228 };
229
230 struct UnpackParams
231 {
232   int axis;
233 };
234
235 } // namespace luci_interpreter
236
237 #endif // LUCI_INTERPRETER_CORE_KERNELPARAMS_H