You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

common_func.h 4.0 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #ifndef MINDSPORE_LITE_NNACL_FP32_COMMON_FUNC_H_
  17. #define MINDSPORE_LITE_NNACL_FP32_COMMON_FUNC_H_
  18. #include <stdint.h>
  19. #include <stdio.h>
  20. #include <string.h>
  21. #include "nnacl/op_base.h"
  22. #include "nnacl/conv_parameter.h"
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. void PostConvFuncFp32C8(const float *c8_out_ptr, float *out_ptr, const float *bias_ptr, size_t output_channel,
  27. size_t plane_size, size_t stride, size_t relu_type);
  28. void PostConvFuncFp32C4(const float *c4_out_ptr, float *out_ptr, const float *bias_ptr, size_t output_channel,
  29. size_t plane_size, size_t plane_stride, size_t relu_type);
  30. void WinogradTransLeft(const float *S, const float *B, float *M, size_t w, size_t h, size_t k, size_t length);
  31. void WinogradTransRight(const float *S, const float *B, float *M, size_t w, size_t h, size_t k, size_t length);
  32. float ShortToFloat32(uint16_t src_value);
  33. uint16_t Float32ToShort(float src_value);
  34. #ifdef ENABLE_ARM
  35. void ConvDwFp32Center(float *dst, const float *src, const float *weight, const float *bias, size_t height, size_t width,
  36. size_t kernel_h, size_t kernel_w, size_t out_h_step, size_t block_channel, size_t in_sh_step,
  37. size_t in_sw_step, size_t in_kh_step, size_t in_kw_step, size_t relu, size_t relu6);
  38. void DeconvDwFp32Center(float *dst, const float *src, const float *weight, size_t height, size_t width, size_t kernel_h,
  39. size_t kernel_w, size_t out_h_step, size_t block_channel, size_t in_sh_step, size_t in_sw_step,
  40. size_t in_kh_step, size_t in_kw_step);
  41. void ConvDwFp32Row(float *output_ptr, const float *input_ptr, const float *weight_ptr, size_t num_pixels,
  42. size_t output_channel, size_t input_step);
  43. void ConvDwFp32Border(float *dst, const float *src, const float *weight, const float *bias, size_t height, size_t width,
  44. size_t in_kh_step, size_t in_kw_step, size_t kernel_w, size_t relu, size_t relu6);
  45. void PostFuncBiasReluC8(float *dst, const float *src, const float *bias, size_t oc8div, size_t oc8mod,
  46. size_t plane_size, size_t stride, size_t relu_type);
  47. void PostFuncBiasReluC4(float *dst, const float *src, const float *bias, size_t oc4div, size_t oc4mod,
  48. size_t plane_size, size_t plane_stride, size_t relu_type);
  49. #endif
  50. #ifdef ENABLE_ARM64
  51. void BiasAdd(const float *bias, float *data, size_t oc4, size_t plan_size);
  52. void BiasAddRelu6(const float *bias, float *data, size_t oc4, size_t plan_size);
  53. void BiasAddRelu(const float *bias, float *data, size_t oc4, size_t plan_size);
  54. void Relu6(float *data, size_t element4);
  55. void Relu(float *data, size_t element4);
  56. void DeconvDwFp32Border(float *dst, const float *src, const float *weight, size_t height, size_t width,
  57. size_t in_kh_step, size_t in_kw_step, size_t kernel_w);
  58. void ConvSwFp32Center(float *dst, const float *src, const float *weight, const float *bias, size_t height, size_t width,
  59. size_t kernel_h, size_t kernel_w, size_t out_h_step, size_t block_channel, size_t ic4,
  60. size_t in_sh_step, size_t in_sw_step, size_t in_kh_step, size_t in_kw_step, size_t relu,
  61. size_t relu6);
  62. #endif
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif /* MINDSPORE_LITE_NNACL_FP32_COMMON_FUNC_H_ */