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.

matmul_parameter.h 2.7 kB

5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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_MATMUL_H_
  17. #define MINDSPORE_LITE_NNACL_MATMUL_H_
  18. #include "nnacl/op_base.h"
  19. typedef void (*MATMUL_OPT_R4_FUNC)(const int8_t *a, const int8_t *b, int *dst, int row_4, int col_4, int deep_16,
  20. const int *input_sum, const int *bias);
  21. typedef void (*MATMUL_OPT_R_FUNC)(const int8_t *a, const int8_t *b, int8_t *dst, size_t row, size_t col, size_t deep_4,
  22. size_t stride, const int32_t *input_sum, const int32_t *bias, int32_t *left_shift,
  23. int32_t *right_shift, int32_t *multiplier, int32_t output_zp, int32_t mini,
  24. int32_t maxi, size_t per_channel);
  25. typedef void (*MATMUL_OPT_DP_FUNC)(const int8_t *a, const int8_t *b, int8_t *dst, size_t row, size_t col, size_t deep_4,
  26. size_t stride, const int32_t *input_sum, const int32_t *bias, int32_t *left_shift,
  27. int32_t *right_shift, int32_t *multiplier, int32_t output_zp, int32_t mini,
  28. int32_t maxi, size_t per_channel, int *filter_zp);
  29. typedef enum OutType { OutType_C8 = 0, OutType_Nhwc = 1, OutType_TileC8 = 2 } OutType;
  30. typedef struct MatMulParameter {
  31. // Primitive parameter
  32. OpParameter op_parameter_;
  33. bool has_bias_;
  34. // other parameter
  35. int row_;
  36. int col_;
  37. int row_4_;
  38. int row_6_;
  39. int row_12_;
  40. int row_16_;
  41. int row_align_;
  42. int col_4_;
  43. int col_8_;
  44. int col_align_;
  45. int deep_;
  46. int deep_4_;
  47. int deep_16_;
  48. int batch;
  49. bool a_transpose_; /* false : row-major */
  50. bool b_transpose_; /* true : col-major */
  51. bool a_const_;
  52. bool b_const_;
  53. ActType act_type_;
  54. } MatMulParameter;
  55. typedef struct MatmulQuantParameter {
  56. QuantArg input_;
  57. QuantArg output_;
  58. int32_t out_act_min_;
  59. int32_t out_act_max_;
  60. float *filter_scale_;
  61. int32_t *filter_zp_;
  62. int32_t *left_shift_;
  63. int32_t *right_shift_;
  64. int32_t *quant_multiplier_;
  65. } MatmulQuantParameter;
  66. #endif // MINDSPORE_LITE_NNACL_MATMUL_H_