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.

conv_parameter.h 2.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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_CONV_PARAMETER_H_
  17. #define MINDSPORE_LITE_NNACL_CONV_PARAMETER_H_
  18. #ifdef ENABLE_NEON
  19. #include <arm_neon.h>
  20. #endif
  21. #include "nnacl/op_base.h"
  22. #include "mindspore/lite/nnacl/int8/quantize.h"
  23. typedef struct ConvParameter {
  24. OpParameter op_parameter_;
  25. ConvQuantArg conv_quant_arg_;
  26. int kernel_h_;
  27. int kernel_w_;
  28. int stride_h_;
  29. int stride_w_;
  30. int dilation_h_;
  31. int dilation_w_;
  32. int pad_u_;
  33. int pad_d_;
  34. int pad_l_;
  35. int pad_r_;
  36. int group_;
  37. int tile_num_;
  38. int input_batch_;
  39. int input_h_;
  40. int input_w_;
  41. int input_channel_;
  42. int output_batch_;
  43. int output_h_;
  44. int output_w_;
  45. int output_channel_;
  46. int thread_num_;
  47. int input_unit_;
  48. int output_unit_;
  49. PadMode pad_mode_;
  50. ActType act_type_;
  51. } ConvParameter;
  52. typedef struct SlidingWindowParam {
  53. int left_;
  54. int right_;
  55. int top_;
  56. int bottom_;
  57. int c_block_;
  58. int block_channel_;
  59. int ic4_channel_;
  60. int out_step_;
  61. int out_h_step_;
  62. int in_step_;
  63. int in_h_step_;
  64. int in_sh_step_; // stride H
  65. int in_sw_step_; // stride W
  66. int in_kh_step_; // kernel H
  67. int in_kw_step_; // kernel W
  68. int kernel_step_;
  69. } SlidingWindowParam;
  70. #define OUPUT_UNIT 2
  71. #define DECONV_WINOGRAD_DEFAULT_UNIT 3
  72. #define DECONV_WINOGRAD_DEFAULT_TILE 8
  73. #define DECONV_WINOGRAD_BUFFER_COUNT 8
  74. typedef struct DeConvWg {
  75. void *b_buffer_;
  76. void *AT_;
  77. void *BT_;
  78. int kh_;
  79. int kw_;
  80. int k_;
  81. int i_;
  82. int o_;
  83. } DeConvWg;
  84. typedef struct DeConvWgABuffer {
  85. bool buf_init_;
  86. void *middle_buffer_;
  87. void *dest_buffer_;
  88. } DeConvWgABuffer;
  89. typedef struct DeConvComputeUnit {
  90. void *weight_;
  91. void *tmp_buffer_;
  92. int w_start_;
  93. int h_start_;
  94. int w_size_;
  95. int h_size_;
  96. bool use_winograd_;
  97. DeConvWg winograd_;
  98. } DeConvComputeUnit;
  99. typedef struct DeConvParam {
  100. DeConvComputeUnit *compute_units_;
  101. int compute_size_;
  102. DeConvWgABuffer a_buffer_[DECONV_WINOGRAD_BUFFER_COUNT];
  103. int input_plane_;
  104. int output_plane_;
  105. int kernel_plane_;
  106. int ic_div4_;
  107. int oc_div4_;
  108. int ic_up4_;
  109. int oc_up4_;
  110. int thread_num_;
  111. int in_tile_count_;
  112. int in_tile_h_count_;
  113. int in_tile_w_count_;
  114. int out_tile_h_;
  115. int out_tile_w_;
  116. } DeConvParam;
  117. #endif // MINDSPORE_LITE_NNACL_CONV_PARAMETER_H_