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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 "nnacl/quantization/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. ActType act_type_;
  50. } ConvParameter;
  51. typedef struct SlidingWindowParam {
  52. int left_;
  53. int right_;
  54. int top_;
  55. int bottom_;
  56. int c_block_;
  57. int block_channel_;
  58. int ic4_channel_;
  59. int out_step_;
  60. int out_h_step_;
  61. int in_step_;
  62. int in_h_step_;
  63. int in_sh_step_; // stride H
  64. int in_sw_step_; // stride W
  65. int in_kh_step_; // kernel H
  66. int in_kw_step_; // kernel W
  67. int kernel_step_;
  68. } SlidingWindowParam;
  69. #define DECONV_WINOGRAD_DEFAULT_UNIT 3
  70. #define DECONV_WINOGRAD_DEFAULT_TILE 8
  71. #define DECONV_WINOGRAD_BUFFER_COUNT 8
  72. typedef struct DeConvWg {
  73. void *b_buffer_;
  74. void *AT_;
  75. void *BT_;
  76. int kh_;
  77. int kw_;
  78. int k_;
  79. int i_;
  80. int o_;
  81. } DeConvWg;
  82. typedef struct DeConvWgABuffer {
  83. bool buf_init_;
  84. void *middle_buffer_;
  85. void *dest_buffer_;
  86. } DeConvWgABuffer;
  87. typedef struct DeConvComputeUnit {
  88. void *weight_;
  89. void *tmp_buffer_;
  90. int w_start_;
  91. int h_start_;
  92. int w_size_;
  93. int h_size_;
  94. bool use_winograd_;
  95. DeConvWg winograd_;
  96. } DeConvComputeUnit;
  97. typedef struct DeConvParam {
  98. DeConvComputeUnit *compute_units_;
  99. int compute_size_;
  100. DeConvWgABuffer a_buffer_[DECONV_WINOGRAD_BUFFER_COUNT];
  101. int input_plane_;
  102. int output_plane_;
  103. int kernel_plane_;
  104. int ic_div4_;
  105. int oc_div4_;
  106. int ic_up4_;
  107. int oc_up4_;
  108. int thread_num_;
  109. int in_tile_count_;
  110. int in_tile_h_count_;
  111. int in_tile_w_count_;
  112. int out_tile_h_;
  113. int out_tile_w_;
  114. } DeConvParam;
  115. #endif // MINDSPORE_LITE_NNACL_CONV_PARAMETER_H_