aboutsummaryrefslogtreecommitdiff
path: root/src/dynamic_fusion/utils/Utils.h
diff options
context:
space:
mode:
authorMohammed Suhail Munshi <MohammedSuhail.Munshi@arm.com>2023-01-03 10:16:16 +0000
committerMohammed Suhail Munshi <MohammedSuhail.Munshi@arm.com>2023-01-20 13:11:59 +0000
commita18d85c6d2c0025938c2dc10e553eb82c01922f2 (patch)
treee62ce3acdbe065bedba7355cdaba6cf32d7ce20e /src/dynamic_fusion/utils/Utils.h
parent11f7d7ed4aa6293c8ad115374b7bad9bbf5a8ae7 (diff)
downloadComputeLibrary-a18d85c6d2c0025938c2dc10e553eb82c01922f2.tar.gz
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 <MohammedSuhail.Munshi@arm.com> Change-Id: I0d112545eb9209c836bf9ea153069f8627531e0a Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8893 Reviewed-by: Gunes Bayir <gunes.bayir@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/dynamic_fusion/utils/Utils.h')
-rw-r--r--src/dynamic_fusion/utils/Utils.h21
1 files changed, 17 insertions, 4 deletions
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);
+}
}
}
}