1 /*
2 * SPDX-FileCopyrightText: Copyright 2010-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
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 /* ----------------------------------------------------------------------
20 * Project: CMSIS NN Library
21 * Title: arm_depthwise_conv_wrapper_s16.c
22 * Description: Wrapper API to select appropriate depthwise conv API based
23 * on dimensions.
24 *
25 * $Date: 20 January 2023
26 * $Revision: V.1.1.0
27 *
28 * Target : Arm(R) M-Profile Architecture
29 *
30 * -------------------------------------------------------------------- */
31
32 #include "arm_nnfunctions.h"
33 #include "arm_nnsupportfunctions.h"
34
35 /**
36 * @ingroup Public
37 */
38
39 /**
40 * @addtogroup NNConv
41 * @{
42 */
43
44 /*
45 * s16 Depthwise conv wrapper function
46 *
47 * Refer header file for details.
48 *
49 */
arm_depthwise_conv_wrapper_s16(const cmsis_nn_context * ctx,const cmsis_nn_dw_conv_params * dw_conv_params,const cmsis_nn_per_channel_quant_params * quant_params,const cmsis_nn_dims * input_dims,const int16_t * input,const cmsis_nn_dims * filter_dims,const int8_t * filter,const cmsis_nn_dims * bias_dims,const int64_t * bias,const cmsis_nn_dims * output_dims,int16_t * output)50 arm_cmsis_nn_status arm_depthwise_conv_wrapper_s16(const cmsis_nn_context *ctx,
51 const cmsis_nn_dw_conv_params *dw_conv_params,
52 const cmsis_nn_per_channel_quant_params *quant_params,
53 const cmsis_nn_dims *input_dims,
54 const int16_t *input,
55 const cmsis_nn_dims *filter_dims,
56 const int8_t *filter,
57 const cmsis_nn_dims *bias_dims,
58 const int64_t *bias,
59 const cmsis_nn_dims *output_dims,
60 int16_t *output)
61 {
62 arm_cmsis_nn_status status = ARM_CMSIS_NN_SUCCESS;
63
64 if (USE_FAST_DW_CONV_S16_FUNCTION(dw_conv_params, filter_dims, input_dims))
65 {
66 status = arm_depthwise_conv_fast_s16(ctx,
67 dw_conv_params,
68 quant_params,
69 input_dims,
70 input,
71 filter_dims,
72 filter,
73 bias_dims,
74 bias,
75 output_dims,
76 output);
77 }
78 else
79 {
80 status = arm_depthwise_conv_s16(ctx,
81 dw_conv_params,
82 quant_params,
83 input_dims,
84 input,
85 filter_dims,
86 filter,
87 bias_dims,
88 bias,
89 output_dims,
90 output);
91 }
92
93 /* Return to application */
94 return status;
95 }
96
97 /**
98 * @} end of NNConv group
99 */
100