SHL 2.2.x
Loading...
Searching...
No Matches
shl_pnna.h
1/*
2 * Copyright (C) 2016-2023 T-Head Semiconductor Co., Ltd. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19/* SHL version 2.2.x */
20
21#ifndef INCLUDE_SHL_PNNA_H_
22#define INCLUDE_SHL_PNNA_H_
23#include "csi_nn.h"
24#include "shl_utils.h"
25
26int shl_pnna_conv2d(struct csinn_tensor *input, struct csinn_tensor *output,
27 struct csinn_tensor *kernel, struct csinn_tensor *bias,
28 struct csinn_conv2d_params *params);
29
30int shl_pnna_depthwise_conv2d(struct csinn_tensor *input, struct csinn_tensor *output,
31 struct csinn_tensor *kernel, struct csinn_tensor *bias,
32 struct csinn_conv2d_params *params);
33
34int shl_pnna_group_conv2d(struct csinn_tensor *input, struct csinn_tensor *output,
35 struct csinn_tensor *kernel, struct csinn_tensor *bias,
36 struct csinn_conv2d_params *params);
37
38int shl_pnna_deconv2d(struct csinn_tensor *input, struct csinn_tensor *output,
39 struct csinn_tensor *kernel, struct csinn_tensor *bias,
40 struct csinn_conv2d_params *params);
41
42int shl_pnna_depthwise_deconv2d(struct csinn_tensor *input, struct csinn_tensor *output,
43 struct csinn_tensor *kernel, struct csinn_tensor *bias,
44 struct csinn_conv2d_params *params);
45
46int shl_pnna_fullyconnected(struct csinn_tensor *input, struct csinn_tensor *output,
47 struct csinn_tensor *weights, struct csinn_tensor *bias,
48 struct csinn_fc_params *params);
49
50int shl_pnna_maxpool2d(struct csinn_tensor *input, struct csinn_tensor *output,
51 struct csinn_pool_params *params);
52
53int shl_pnna_avgpool2d(struct csinn_tensor *input, struct csinn_tensor *output,
54 struct csinn_pool_params *params);
55
56int shl_pnna_global_avgpool2d(struct csinn_tensor *input, struct csinn_tensor *output,
57 struct csinn_pool_params *params);
58
59int shl_pnna_global_maxpool2d(struct csinn_tensor *input, struct csinn_tensor *output,
60 struct csinn_pool_params *params);
61
62int shl_pnna_negative(struct csinn_tensor *input, struct csinn_tensor *output,
63 struct csinn_siso_params *params);
64
65int shl_pnna_tanh(struct csinn_tensor *input, struct csinn_tensor *output,
66 struct csinn_siso_params *params);
67
68int shl_pnna_sigmoid(struct csinn_tensor *input, struct csinn_tensor *output,
69 struct csinn_sigmoid_params *params);
70
71int shl_pnna_elu(struct csinn_tensor *input, struct csinn_tensor *output,
72 struct csinn_relu_params *params);
73
74int shl_pnna_relu(struct csinn_tensor *input, struct csinn_tensor *output,
75 struct csinn_relu_params *params);
76
77int shl_pnna_relu1(struct csinn_tensor *input, struct csinn_tensor *output,
78 struct csinn_relu_params *params);
79
80int shl_pnna_relu6(struct csinn_tensor *input, struct csinn_tensor *output,
81 struct csinn_relu_params *params);
82
83int shl_pnna_leaky_relu(struct csinn_tensor *input, struct csinn_tensor *output,
84 struct csinn_relu_params *params);
85
86int shl_pnna_prelu(struct csinn_tensor *input, struct csinn_tensor *alpha,
87 struct csinn_tensor *output, struct csinn_prelu_params *params);
88
89int shl_pnna_softmax(struct csinn_tensor *input, struct csinn_tensor *output,
90 struct csinn_softmax_params *params);
91
92int shl_pnna_batch_normalization(struct csinn_tensor *input, struct csinn_tensor *mean,
93 struct csinn_tensor *variance, struct csinn_tensor *gamma,
94 struct csinn_tensor *beta, struct csinn_tensor *output,
95 struct csinn_bn_params *params);
96
97int shl_pnna_l2_normalization(struct csinn_tensor *input, struct csinn_tensor *output,
98 struct csinn_l2n_params *params);
99
100int shl_pnna_lrn(struct csinn_tensor *input, struct csinn_tensor *output,
101 struct csinn_lrn_params *params);
102
103int shl_pnna_matmul(struct csinn_tensor *mat0, struct csinn_tensor *mat1,
104 struct csinn_tensor *output, struct csinn_matmul_params *params);
105
106int shl_pnna_add(struct csinn_tensor *input0, struct csinn_tensor *input1,
107 struct csinn_tensor *output, struct csinn_diso_params *params);
108
109int shl_pnna_sub(struct csinn_tensor *input0, struct csinn_tensor *input1,
110 struct csinn_tensor *output, struct csinn_diso_params *params);
111
112int shl_pnna_mul(struct csinn_tensor *input0, struct csinn_tensor *input1,
113 struct csinn_tensor *output, struct csinn_diso_params *params);
114
115int shl_pnna_div(struct csinn_tensor *input0, struct csinn_tensor *input1,
116 struct csinn_tensor *output, struct csinn_diso_params *params);
117
118int shl_pnna_maximum(struct csinn_tensor *input0, struct csinn_tensor *input1,
119 struct csinn_tensor *output, struct csinn_diso_params *params);
120
121int shl_pnna_minimum(struct csinn_tensor *input0, struct csinn_tensor *input1,
122 struct csinn_tensor *output, struct csinn_diso_params *params);
123
124int shl_pnna_power(struct csinn_tensor *input0, struct csinn_tensor *input1,
125 struct csinn_tensor *output, struct csinn_diso_params *params);
126
127int shl_pnna_greater(struct csinn_tensor *input0, struct csinn_tensor *input1,
128 struct csinn_tensor *output, struct csinn_diso_params *params);
129
130int shl_pnna_less(struct csinn_tensor *input0, struct csinn_tensor *input1,
131 struct csinn_tensor *output, struct csinn_diso_params *params);
132
133int shl_pnna_equal(struct csinn_tensor *input0, struct csinn_tensor *input1,
134 struct csinn_tensor *output, struct csinn_diso_params *params);
135
136int shl_pnna_not_equal(struct csinn_tensor *input0, struct csinn_tensor *input1,
137 struct csinn_tensor *output, struct csinn_diso_params *params);
138
139int shl_pnna_greater_equal(struct csinn_tensor *input0, struct csinn_tensor *input1,
140 struct csinn_tensor *output, struct csinn_diso_params *params);
141
142int shl_pnna_less_equal(struct csinn_tensor *input0, struct csinn_tensor *input1,
143 struct csinn_tensor *output, struct csinn_diso_params *params);
144
145int shl_pnna_select(struct csinn_tensor *condition, struct csinn_tensor *input0,
146 struct csinn_tensor *input1, struct csinn_tensor *output,
147 struct csinn_diso_params *params);
148
149int shl_pnna_and(struct csinn_tensor *input0, struct csinn_tensor *input1,
150 struct csinn_tensor *output, struct csinn_diso_params *params);
151
152int shl_pnna_or(struct csinn_tensor *input0, struct csinn_tensor *input1,
153 struct csinn_tensor *output, struct csinn_diso_params *params);
154
155int shl_pnna_pad(struct csinn_tensor *input, struct csinn_tensor *output,
156 struct csinn_pad_params *params);
157
158int shl_pnna_resize(struct csinn_tensor *input, struct csinn_tensor *output,
159 struct csinn_resize_params *params);
160
161int shl_pnna_concat(struct csinn_tensor **input, struct csinn_tensor *output,
162 struct csinn_concat_params *params);
163
164int shl_pnna_transpose(struct csinn_tensor *input, struct csinn_tensor *output,
165 struct csinn_transpose_params *params);
166
167int shl_pnna_reshape(struct csinn_tensor *input, struct csinn_tensor *output,
168 struct csinn_reshape_params *params);
169
170int shl_pnna_shape(struct csinn_tensor *input, struct csinn_tensor *output,
171 struct csinn_shape_params *params);
172
173int shl_pnna_flatten(struct csinn_tensor *input, struct csinn_tensor *output,
174 struct csinn_flatten_params *params);
175
176int shl_pnna_crop(struct csinn_tensor *input, struct csinn_tensor *output,
177 struct csinn_crop_params *params);
178
179int shl_pnna_slice(struct csinn_tensor *input, struct csinn_tensor *output,
180 struct csinn_slice_params *params);
181
182int shl_pnna_split(struct csinn_tensor *input, struct csinn_tensor **output,
183 struct csinn_split_params *params);
184
185int shl_pnna_squeeze(struct csinn_tensor *input, struct csinn_tensor *output,
186 struct csinn_squeeze_params *params);
187
188int shl_pnna_space_to_batch_nd(struct csinn_tensor *input, struct csinn_tensor *output,
189 struct csinn_space_to_batch_nd_params *params);
190
191int shl_pnna_batch_to_space_nd(struct csinn_tensor *input, struct csinn_tensor *output,
192 struct csinn_batch_to_space_nd_params *params);
193
194int shl_pnna_space_to_depth(struct csinn_tensor *input, struct csinn_tensor *output,
195 struct csinn_space_to_depth_params *params);
196
197int shl_pnna_depth_to_space(struct csinn_tensor *input, struct csinn_tensor *output,
198 struct csinn_depth_to_space_params *params);
199
200int shl_pnna_sum(struct csinn_tensor *input, struct csinn_tensor *output,
201 struct csinn_reduce_params *params);
202
203int shl_pnna_mean(struct csinn_tensor *input, struct csinn_tensor *output,
204 struct csinn_reduce_params *params);
205
206int shl_pnna_max(struct csinn_tensor *input, struct csinn_tensor *output,
207 struct csinn_reduce_params *params);
208
209int shl_pnna_min(struct csinn_tensor *input, struct csinn_tensor *output,
210 struct csinn_reduce_params *params);
211
212int shl_pnna_prod(struct csinn_tensor *input, struct csinn_tensor *output,
213 struct csinn_reduce_params *params);
214
215int shl_pnna_argmin(struct csinn_tensor *input, struct csinn_tensor *output,
216 struct csinn_reduce_params *params);
217
218int shl_pnna_argmax(struct csinn_tensor *input, struct csinn_tensor *output,
219 struct csinn_reduce_params *params);
220
221int shl_pnna_all(struct csinn_tensor *input, struct csinn_tensor *output,
222 struct csinn_reduce_params *params);
223
224int shl_pnna_any(struct csinn_tensor *input, struct csinn_tensor *output,
225 struct csinn_reduce_params *params);
226
227int shl_pnna_strided_slice(struct csinn_tensor *input, struct csinn_tensor *output,
228 struct csinn_strided_slice_params *params);
229
230int shl_pnna_roipool(struct csinn_tensor *data, struct csinn_tensor *rois,
231 struct csinn_tensor *output, struct csinn_roi_pool_params *params);
232
233int shl_pnna_proposal(struct csinn_tensor *cls_prob, struct csinn_tensor *bbox_pred,
234 struct csinn_tensor *im_info, struct csinn_tensor *output,
235 struct csinn_proposal_params *params);
236
237int shl_pnna_unpooling(struct csinn_tensor *input, struct csinn_tensor *mask,
238 struct csinn_tensor *output, struct csinn_unpooling_params *params);
239
240int shl_pnna_maxpool2d_locat(struct csinn_tensor *input, struct csinn_tensor *output,
241 struct csinn_pool_params *params);
242int shl_pnna_sqrt(struct csinn_tensor *input, struct csinn_tensor *output,
243 struct csinn_siso_params *params);
244int shl_pnna_matmul(struct csinn_tensor *input0, struct csinn_tensor *input1,
245 struct csinn_tensor *output, struct csinn_matmul_params *params);
246
247int shl_pnna_data_covert(struct csinn_tensor *input, struct csinn_tensor *output,
248 struct csinn_siso_params *params);
249
250int shl_pnna_set_input_strides(struct csinn_session *sess, int input_byte_size, int input_fix_h,
251 int input_fix_w);
252
253struct shl_pnna_tensor_fix {
254 int height;
255 int width;
256};
257
258struct shl_pnna_target_data {
259 void *network;
260 void *net_obj;
261 void *context;
262 void *binding;
263 void *attrs;
264 void *graph;
265 void *nodes;
266 void *in_buffers;
267 void *out_buffers;
268 void *th1520_hwconfig;
269 void *th1520_mapconfig;
270 void *to_free;
271 int priority;
272 struct shl_pnna_tensor_fix **input_fix;
273 enum csinn_quant_enum quant_type;
274};
275
276#endif // INCLUDE_SHL_PNNA_H_
csinn_quant_enum
Definition: csinn_data_structure.h:67
Definition: csinn_data_structure.h:969
Definition: csinn_data_structure.h:705
Definition: csinn_data_structure.h:780
Definition: csinn_data_structure.h:553
Definition: csinn_data_structure.h:854
Definition: csinn_data_structure.h:984
Definition: csinn_data_structure.h:753
Definition: csinn_data_structure.h:596
Definition: csinn_data_structure.h:849
Definition: csinn_data_structure.h:715
Definition: csinn_data_structure.h:727
Definition: csinn_data_structure.h:746
Definition: csinn_data_structure.h:763
Definition: csinn_data_structure.h:605
Definition: csinn_data_structure.h:686
Definition: csinn_data_structure.h:787
Definition: csinn_data_structure.h:1033
Definition: csinn_data_structure.h:676
Definition: csinn_data_structure.h:825
Definition: csinn_data_structure.h:773
Definition: csinn_data_structure.h:649
Definition: csinn_data_structure.h:502
Definition: csinn_data_structure.h:832
Definition: csinn_data_structure.h:671
Definition: csinn_data_structure.h:661
Definition: csinn_data_structure.h:862
Definition: csinn_data_structure.h:692
Definition: csinn_data_structure.h:951
Definition: csinn_data_structure.h:978
Definition: csinn_data_structure.h:871
Definition: csinn_data_structure.h:929
Definition: csinn_data_structure.h:1088
Definition: csinn_data_structure.h:475
Definition: csinn_data_structure.h:818
Definition: csinn_data_structure.h:627