COMPMID-1794: Add support for NHWC in CLROIAlignLayer
Change-Id: If1df8f6c0549c986e607cbceb0977c80b2891b75
Reviewed-on: https://review.mlplatform.org/493
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Isabella Gottardi <isabella.gottardi@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h
index f8a6df7..35e2167 100644
--- a/arm_compute/core/utils/misc/ShapeCalculator.h
+++ b/arm_compute/core/utils/misc/ShapeCalculator.h
@@ -745,6 +745,28 @@
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