aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/utils
diff options
context:
space:
mode:
authorGiorgio Arena <giorgio.arena@arm.com>2018-05-01 11:47:24 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:50:48 +0000
commit3c520c5a6ca9352560828fdf389d31e38b85afeb (patch)
tree9a7cbbb2fdf0f9f6c8e42cfd36d2ea8b842fe3d4 /arm_compute/core/utils
parent6c4212789a530c3655258779219c4ed7f0397b86 (diff)
downloadComputeLibrary-3c520c5a6ca9352560828fdf389d31e38b85afeb.tar.gz
COMPMID-1089 CLPoolingLayer fix padding and add output shape computation to ShapeCalculator
Change-Id: Ide83424e9fe6b8102ed9e3c355c099c3912e7e61 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/129635 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Michele DiGiorgio <michele.digiorgio@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'arm_compute/core/utils')
-rw-r--r--arm_compute/core/utils/misc/ShapeCalculator.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h
index a0bc4eab54..757e423d4f 100644
--- a/arm_compute/core/utils/misc/ShapeCalculator.h
+++ b/arm_compute/core/utils/misc/ShapeCalculator.h
@@ -331,21 +331,22 @@ inline TensorShape compute_pool_shape(const ITensorInfo &input, PoolingLayerInfo
unsigned int pooled_w = 0;
unsigned int pooled_h = 0;
+ TensorShape output_shape{ input.tensor_shape() };
+
const bool is_global_pooling = pool_info.is_global_pooling();
- const int idx_width = get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::WIDTH);
- const int idx_height = get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::HEIGHT);
- const unsigned int pool_size_x = is_global_pooling ? input.tensor_shape()[idx_width] : pool_info.pool_size().width;
- const unsigned int pool_size_y = is_global_pooling ? input.tensor_shape()[idx_height] : pool_info.pool_size().height;
+ const unsigned int idx_width = get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::WIDTH);
+ const unsigned int idx_height = get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::HEIGHT);
+ const unsigned int pool_size_x = is_global_pooling ? output_shape[idx_width] : pool_info.pool_size().width;
+ const unsigned int pool_size_y = is_global_pooling ? output_shape[idx_height] : pool_info.pool_size().height;
- std::tie(pooled_w, pooled_h) = scaled_dimensions(input.dimension(idx_width),
- input.dimension(idx_height),
+ std::tie(pooled_w, pooled_h) = scaled_dimensions(output_shape[idx_width],
+ output_shape[idx_height],
pool_size_x,
pool_size_y,
pool_info.pad_stride_info());
- TensorShape output_shape{ input.tensor_shape() };
- output_shape.set(get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::WIDTH), pooled_w);
- output_shape.set(get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::HEIGHT), pooled_h);
+ output_shape.set(idx_width, pooled_w);
+ output_shape.set(idx_height, pooled_h);
return output_shape;
}