From 227db8db83cd85d8704a8edbd4e8c88af0dd1f84 Mon Sep 17 00:00:00 2001 From: Adnan AlSinan Date: Tue, 14 Feb 2023 14:24:09 +0000 Subject: Add an option to use lowest for max-pooling - Add a parameter in PoolingLayerInfo class to pick which value to use as min for max-pooling. Resolves: [ONCPUML-1166] Signed-off-by: Adnan AlSinan Change-Id: I34e1cccc15176bbf31523c61e99f3188ddca23e1 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8989 Comments-Addressed: Arm Jenkins Reviewed-by: SiCong Li Reviewed-by: Pablo Marquez Tello Tested-by: Arm Jenkins Benchmark: Arm Jenkins --- src/cpu/kernels/pool2d/neon/fp16.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/cpu/kernels/pool2d/neon/fp16.cpp') diff --git a/src/cpu/kernels/pool2d/neon/fp16.cpp b/src/cpu/kernels/pool2d/neon/fp16.cpp index 13e21b1e70..4e15d3ad3f 100644 --- a/src/cpu/kernels/pool2d/neon/fp16.cpp +++ b/src/cpu/kernels/pool2d/neon/fp16.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Arm Limited. + * Copyright (c) 2021-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -176,10 +176,10 @@ void poolingMxN_fp16_neon_nhwc(const ITensor *src, ITensor *dst0, ITensor *dst1, int pool_stride_x = 0; int pool_stride_y = 0; std::tie(pool_stride_x, pool_stride_y) = pool_info.pad_stride_info.stride(); - const int upper_bound_w = src->info()->dimension(1) + (pool_info.exclude_padding ? 0 : pool_pad_right); - const int upper_bound_h = src->info()->dimension(2) + (pool_info.exclude_padding ? 0 : pool_pad_bottom); - - float16x8_t vres; + const int upper_bound_w = src->info()->dimension(1) + (pool_info.exclude_padding ? 0 : pool_pad_right); + const int upper_bound_h = src->info()->dimension(2) + (pool_info.exclude_padding ? 0 : pool_pad_bottom); + const float16_t min_value = get_initial_min(pool_info.use_inf_as_limit); + float16x8_t vres; execute_window_loop(window_out, [&](const Coordinates & id) { @@ -228,7 +228,7 @@ void poolingMxN_fp16_neon_nhwc(const ITensor *src, ITensor *dst0, ITensor *dst1, } else { - vres = vdupq_n_f16(-std::numeric_limits::infinity()); + vres = vdupq_n_f16(min_value); for(int y = pool_start_y; y < pool_end_y; ++y) { @@ -287,7 +287,7 @@ void poolingMxN_fp16_neon_nhwc(const ITensor *src, ITensor *dst0, ITensor *dst1, } else { - res = -std::numeric_limits::infinity(); + res = min_value; for(int y = pool_start_y; y < pool_end_y; ++y) { for(int x = pool_start_x; x < pool_end_x; ++x) -- cgit v1.2.1