From 918a9fb4aa4be23ca4261c241e9e52acc42f9bb3 Mon Sep 17 00:00:00 2001 From: Gunes Bayir Date: Tue, 15 Feb 2022 11:40:13 +0000 Subject: Add Pool3d reference implementation This patch - adds the reference implementation for the 3D pooling layer - supports FP32/FP16 and INT8/UINT8 types - adds a function to calculate the output shape for 3D pooling - adds a new type for describing pool 3d info (Pool3DInfo) Resolves: COMPMID-4659 Change-Id: I22a18fa30625c98fa827ef1b50781db6893ba9c4 Signed-off-by: Gunes Bayir Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/7219 Reviewed-by: Gian Marco Iodice Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- arm_compute/core/Types.h | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'arm_compute/core/Types.h') diff --git a/arm_compute/core/Types.h b/arm_compute/core/Types.h index 9615811349..6c49cc35c0 100644 --- a/arm_compute/core/Types.h +++ b/arm_compute/core/Types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021 Arm Limited. + * Copyright (c) 2016-2022 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -1307,6 +1307,42 @@ private: unsigned int _sampling_ratio; }; +struct Pool3DInfo +{ + Pool3DInfo() = default; + + /** Constructor + * + * @param[in] pool_type Pooling type @ref PoolingType. + * @param[in] pool_size Pooling size, in elements, across x, y and z @ref Size3D + * @param[in] padding Paddings in x, y and z dimensions + * @param[in] strides Strides in x, y and z dimensions @ref Size3D + * @param[in] round_type Dimension rounding type (ceil or floor) + * @param[in] exclude_padding Strategy when accounting padding in calculations. + * True will exclude padding while false will not (Used in AVG/L2 pooling to determine the pooling area). + * @param[in] is_global_pooling Sets the pool size to the input size if True + */ + Pool3DInfo(const PoolingType pool_type, + const Size3D pool_size, + const Padding3D padding, + const Size3D strides, + const DimensionRoundingType round_type, + bool exclude_padding, + bool is_global_pooling) + : pool_type(pool_type), pool_size(pool_size), padding(padding), strides(strides), round_type(round_type), exclude_padding(exclude_padding), is_global_pooling(is_global_pooling) + + { + } + + PoolingType pool_type{ PoolingType::MAX }; + Size3D pool_size{ 1U, 1U, 1U }; + Padding3D padding{}; + Size3D strides{ 1U, 1U, 1U }; + DimensionRoundingType round_type{ DimensionRoundingType::FLOOR }; + bool exclude_padding{ false }; + bool is_global_pooling{ false }; +}; + /** Generate Proposals Information class */ class GenerateProposalsInfo { -- cgit v1.2.1