26 #ifdef __ARM_FP16_ARGS 35 #if defined(__aarch64__) 36 #if defined(ARM_COMPUTE_ENABLE_SVE) 41 #endif // defined(ARM_COMPUTE_ENABLE_SVE) 46 #endif // defined(__aarch64__) 53 template <
class Strategy>
54 bool is_supported(
const PoolingArgs &
args,
const Nothing &)
56 return ((args.pool_type == Strategy::pooling_type()) &&
57 (args.pool_window.rows == Strategy::pool_rows()) &&
58 (args.pool_window.cols == Strategy::pool_cols()) &&
59 (args.pool_stride.rows == Strategy::stride_rows()) &&
60 (args.pool_stride.cols == Strategy::stride_cols()));
64 static const PoolingImplementation<__fp16, __fp16> pooling_fp16_methods[] = {
66 PoolingMethod::DEPTHFIRST,
67 "cpp_fp16_nhwc_1x1_stride_any_depthfirst",
68 [] (
const PoolingArgs &
args,
const Nothing &) ->
bool {
69 return args.pool_window.rows == 1 && args.pool_window.cols == 1;
72 [] (
const PoolingArgs &
args,
const Nothing &) -> PoolingCommon<__fp16, __fp16> * {
73 return new PoolingDepthfirstGeneric<cpp_nhwc_1x1_stride_any_depthfirst<__fp16>>(
args);
76 #if defined(__aarch64__) 77 #if defined(ARM_COMPUTE_ENABLE_SVE) 79 PoolingMethod::DEPTHFIRST,
80 "sve_fp16_nhwc_max_2x2_s1_output2x2_depthfirst",
81 [] (
const PoolingArgs &
args,
const Nothing &unused) ->
bool {
82 return args.cpu_info->has_sve() && is_supported<sve_fp16_nhwc_max_2x2_s1_output2x2_depthfirst>(
args, unused);
85 [] (
const PoolingArgs &
args,
const Nothing &) -> PoolingCommon<__fp16, __fp16> * {
86 return new PoolingDepthfirst<sve_fp16_nhwc_max_2x2_s1_output2x2_depthfirst>(
args);
90 PoolingMethod::DEPTHFIRST,
91 "sve_fp16_nhwc_avg_3x3_s1_output2x2_depthfirst",
92 [] (
const PoolingArgs &
args,
const Nothing &unused) ->
bool {
93 return args.cpu_info->has_sve() && is_supported<sve_fp16_nhwc_avg_3x3_s1_output2x2_depthfirst>(
args, unused);
96 [] (
const PoolingArgs &
args,
const Nothing &) -> PoolingCommon<__fp16, __fp16> * {
97 return new PoolingDepthfirst<sve_fp16_nhwc_avg_3x3_s1_output2x2_depthfirst>(
args);
101 PoolingMethod::DEPTHFIRST,
102 "sve_fp16_nhwc_avg_generic_depthfirst",
103 [] (
const PoolingArgs &
args,
const Nothing &) ->
bool {
return args.cpu_info->has_sve() && args.pool_type == PoolingType::AVERAGE; },
105 [] (
const PoolingArgs &
args,
const Nothing &) -> PoolingCommon<__fp16, __fp16> * {
106 return new PoolingDepthfirstGeneric<sve_fp16_nhwc_avg_generic_depthfirst>(
args);
110 PoolingMethod::DEPTHFIRST,
111 "sve_fp16_nhwc_max_generic_depthfirst",
112 [] (
const PoolingArgs &
args,
const Nothing &) ->
bool {
return args.cpu_info->has_sve() && args.pool_type ==
PoolingType::MAX; },
114 [] (
const PoolingArgs &
args,
const Nothing &) -> PoolingCommon<__fp16, __fp16> * {
115 return new PoolingDepthfirstGeneric<sve_fp16_nhwc_max_generic_depthfirst>(
args);
118 #endif // defined(ARM_COMPUTE_ENABLE_SVE) 119 #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) 121 PoolingMethod::DEPTHFIRST,
122 "a64_fp16_nhwc_max_2x2_s1_output2x2_depthfirst",
123 [] (
const PoolingArgs &
args,
const Nothing &unused) ->
bool {
124 return args.cpu_info->has_fp16() && is_supported<a64_fp16_nhwc_max_2x2_s1_output2x2_depthfirst>(
args, unused);
127 [] (
const PoolingArgs &
args,
const Nothing &) -> PoolingCommon<__fp16, __fp16> * {
128 return new PoolingDepthfirst<a64_fp16_nhwc_max_2x2_s1_output2x2_depthfirst>(
args);
132 PoolingMethod::DEPTHFIRST,
133 "a64_fp16_nhwc_avg_3x3_s1_output2x2_depthfirst",
134 [] (
const PoolingArgs &
args,
const Nothing &unused) ->
bool {
135 return args.cpu_info->has_fp16() && is_supported<a64_fp16_nhwc_avg_3x3_s1_output2x2_depthfirst>(
args, unused);
138 [] (
const PoolingArgs &
args,
const Nothing &) -> PoolingCommon<__fp16, __fp16> * {
139 return new PoolingDepthfirst<a64_fp16_nhwc_avg_3x3_s1_output2x2_depthfirst>(
args);
143 PoolingMethod::DEPTHFIRST,
144 "a64_fp16_nhwc_avg_generic_depthfirst",
145 [] (
const PoolingArgs &
args,
const Nothing &) ->
bool {
return args.cpu_info->has_fp16() && args.pool_type == PoolingType::AVERAGE; },
147 [] (
const PoolingArgs &
args,
const Nothing &) -> PoolingCommon<__fp16, __fp16> * {
148 return new PoolingDepthfirstGeneric<a64_fp16_nhwc_avg_generic_depthfirst>(
args);
152 PoolingMethod::DEPTHFIRST,
153 "a64_fp16_nhwc_max_generic_depthfirst",
154 [] (
const PoolingArgs &
args,
const Nothing &) ->
bool {
return args.cpu_info->has_fp16() && args.pool_type ==
PoolingType::MAX; },
156 [] (
const PoolingArgs &
args,
const Nothing &) -> PoolingCommon<__fp16, __fp16> * {
157 return new PoolingDepthfirstGeneric<a64_fp16_nhwc_max_generic_depthfirst>(
args);
160 #endif // defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) 161 #endif // defined(__aarch64__) 162 { PoolingMethod::DEFAULT,
"",
nullptr,
nullptr,
nullptr },
168 return pooling_fp16_methods;
171 template UniquePoolingCommon<__fp16, __fp16>
pooling(
const PoolingArgs &,
const Nothing &);
176 #endif // __ARM_FP16_ARGS
template UniquePoolingCommon< float, float > pooling(const PoolingArgs &, const Nothing &)
const PoolingImplementation< float, float > * pooling_implementation_list()