diff options
Diffstat (limited to 'arm_compute/core')
-rw-r--r-- | arm_compute/core/utils/misc/ShapeCalculator.h | 22 |
1 files changed, 22 insertions, 0 deletions
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 |