1 /** 2 * Copyright 2020 Huawei Technologies Co., Ltd 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 MINDSPORE_NNACL_FP16_WINOGRAD_TRANSFORM_FP16_H_ 18 #define MINDSPORE_NNACL_FP16_WINOGRAD_TRANSFORM_FP16_H_ 19 20 #include <arm_neon.h> 21 #include <string.h> 22 #include "nnacl/errorcode.h" 23 #include "nnacl/fp16/cast_fp16.h" 24 #include "nnacl/fp16/conv_fp16.h" 25 #include "nnacl/fp16/matrix_fp16.h" 26 #include "nnacl/fp16/pack_fp16.h" 27 28 #ifdef __cplusplus 29 extern "C" { 30 #endif 31 // fp16 common winograd 32 void WinogradInputTransformFp16(const float16_t *input_data, float16_t *trans_input, float16_t *tmp_data, int cal_num, 33 int out_tile_index, int out_w_block_num, const ConvParameter *conv_param, 34 InputTransFp16Func func); 35 36 void WinogradOutputNHWCTransformFp16(const float16_t *gemm_out, float16_t *tmp_out_data, const float16_t *bias_data, 37 int cal_num, int out_tile_index, int output_unit_num, 38 const ConvParameter *conv_param, OutputTransFp16Func func); 39 40 void WinogradOutputNC8HW8TransformFp16(const float16_t *gemm_out, float16_t *tmp_out_data, const float16_t *bias_data, 41 int cal_num, int out_tile_index, int output_unit_num, 42 const ConvParameter *conv_param, OutputTransFp16Func func); 43 44 // fp16 winograd weight trans 45 int WinogradWeightTransformFp16(const float16_t *weight_data, float16_t *winograd_data, const float *matrix_g, 46 const float *matrix_gt, int oc_block, int input_unit, int kernel_unit, 47 int filter_channel, int filter_batch, bool pack); 48 49 #ifdef __cplusplus 50 } 51 #endif 52 53 #endif // MINDSPORE_NNACL_FP16_WINOGRAD_TRANSFORM_FP16_H_ 54