From a18d85c6d2c0025938c2dc10e553eb82c01922f2 Mon Sep 17 00:00:00 2001 From: Mohammed Suhail Munshi Date: Tue, 3 Jan 2023 10:16:16 +0000 Subject: Dynamic Fusion Pooling Layer 2d - Adds Dynamic fusion PoolingLayer2D as Unfusable Operator - Indices are not supported - Adds tests for F32/F16 Datatypes Resolves : [COMPMID-5520] Signed-off-by: Mohammed Suhail Munshi Change-Id: I0d112545eb9209c836bf9ea153069f8627531e0a Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8893 Reviewed-by: Gunes Bayir Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Benchmark: Arm Jenkins --- src/dynamic_fusion/utils/Utils.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/dynamic_fusion/utils') diff --git a/src/dynamic_fusion/utils/Utils.h b/src/dynamic_fusion/utils/Utils.h index 063dbdc44e..d317ec7fd6 100644 --- a/src/dynamic_fusion/utils/Utils.h +++ b/src/dynamic_fusion/utils/Utils.h @@ -25,6 +25,7 @@ #define SRC_DYNAMIC_FUSION_UTILS_UTILS #include "arm_compute/core/ITensorInfo.h" +#include "arm_compute/dynamic_fusion/sketch/attributes/Pool2dAttributes.h" namespace arm_compute { @@ -32,25 +33,37 @@ namespace experimental { namespace dynamic_fusion { -bool is_user_tensor(const ITensorInfo *tensor_info) +inline bool is_user_tensor(const ITensorInfo *tensor_info) { return tensor_info->id() > ITensorInfo::invalid_tensor_id; } -bool is_intermediate_tensor(const ITensorInfo *tensor_info) +inline bool is_intermediate_tensor(const ITensorInfo *tensor_info) { return tensor_info->id() < ITensorInfo::invalid_tensor_id; } -bool is_valid_tensor(const ITensorInfo *tensor_info) +inline bool is_valid_tensor(const ITensorInfo *tensor_info) { return tensor_info->has_valid_id(); } -bool is_invalid_tensor(const ITensorInfo *tensor_info) +inline bool is_invalid_tensor(const ITensorInfo *tensor_info) { return !is_valid_tensor(tensor_info); } + +/** Inline function to convert @ref Pool2dAttributes to PoolingLayerInfo +*/ +inline PoolingLayerInfo convert_pool_attr_to_pool_info(const Pool2dAttributes &pool_attr, bool mixed_precision = false, DataLayout data_layout = DataLayout::NHWC) +{ + // Create PadStrideInfo + const Size2D stride = pool_attr.stride(); + const Padding2D padding = pool_attr.pad(); + const PadStrideInfo pad_stride(stride.x(), stride.y(), padding.left, padding.top, arm_compute::DimensionRoundingType::FLOOR); + + return PoolingLayerInfo(pool_attr.pool_type(), pool_attr.pool_size(), data_layout, pad_stride, pool_attr.exclude_padding(), mixed_precision); +} } } } -- cgit v1.2.1