Imported Upstream version 1.7.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 DepthwiseConv2DParams
60 {
61   Padding padding;
62   int32_t depth_multiplier; // TODO Remove, as it can be calculated.
63   int32_t stride_height;
64   int32_t stride_width;
65   int32_t dilation_height_factor;
66   int32_t dilation_width_factor;
67   Activation activation;
68 };
69
70 struct FullyConnectedParams
71 {
72   Activation activation;
73 };
74
75 struct L2NormParams
76 {
77   Activation activation;
78 };
79
80 struct LeakyReluParams
81 {
82   float alpha;
83 };
84
85 struct LocalResponseNormalizationParams
86 {
87   int32_t radius;
88   float bias;
89   float alpha;
90   float beta;
91 };
92
93 struct MulParams
94 {
95   Activation activation;
96 };
97
98 struct Pool2DParams
99 {
100   Padding padding;
101   int32_t filter_height;
102   int32_t filter_width;
103   int32_t stride_height;
104   int32_t stride_width;
105   Activation activation;
106 };
107
108 struct ReducerParams
109 {
110   bool keep_dims;
111 };
112
113 struct SpaceToDepthParams
114 {
115   int block_size;
116 };
117
118 struct SoftmaxParams
119 {
120   float beta;
121 };
122
123 struct StridedSliceParams
124 {
125   int32_t begin_mask;
126   int32_t end_mask;
127   int32_t ellipsis_mask;
128   int32_t new_axis_mask;
129   int32_t shrink_axis_mask;
130 };
131
132 struct SqueezeParams
133 {
134   std::vector<int32_t> squeeze_dims;
135 };
136
137 struct TransposeConvParams
138 {
139   Padding padding;
140   int32_t stride_height;
141   int32_t stride_width;
142 };
143
144 struct UnpackParams
145 {
146   int axis;
147 };
148
149 } // namespace luci_interpreter
150
151 #endif // LUCI_INTERPRETER_CORE_KERNELPARAMS_H