From 44b4e974590f1a6a07b235f203006cc9010b37e8 Mon Sep 17 00:00:00 2001 From: George Wort Date: Tue, 8 Jan 2019 11:41:54 +0000 Subject: COMPMID-1794: Add support for NHWC in CLROIAlignLayer Change-Id: If1df8f6c0549c986e607cbceb0977c80b2891b75 Reviewed-on: https://review.mlplatform.org/493 Tested-by: Arm Jenkins Reviewed-by: Isabella Gottardi Reviewed-by: Michele Di Giorgio --- arm_compute/core/utils/misc/ShapeCalculator.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'arm_compute') diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h index f8a6df7fe7..35e21679d2 100644 --- a/arm_compute/core/utils/misc/ShapeCalculator.h +++ b/arm_compute/core/utils/misc/ShapeCalculator.h @@ -745,6 +745,28 @@ inline TensorShape compute_pool_shape(const ITensorInfo &input, PoolingLayerInfo return output_shape; } +/** Calculate the output roi align shape of a tensor + * + * @param[in] input Input tensor info + * @param[in] rois Rois tensor info + * @param[in] pool_info Pooling layer info + * + * @return the calculated shape + */ +inline TensorShape compute_roi_align_shape(const ITensorInfo &input, const ITensorInfo &rois, ROIPoolingLayerInfo pool_info) +{ + TensorShape output_shape{ input.tensor_shape() }; + + 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); + + output_shape.set(idx_width, pool_info.pooled_width()); + output_shape.set(idx_height, pool_info.pooled_height()); + output_shape.set(3, rois.dimension(1)); + + return output_shape; +} + /** Calculate the RNN shape of a tensor * * @param[in] input Input tensor info -- cgit v1.2.1