aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuhail Munshi <MohammedSuhail.Munshi@arm.com>2021-05-06 12:43:07 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2021-05-11 17:44:36 +0000
commitee22030441e869a7c4ff632d27a7d45c6168a14e (patch)
tree86e967ca10635e5e14d7ca8d4b3ab454252095d6
parenta0577b8bc355089f1b3138e4fa2fe082a06b91a9 (diff)
downloadComputeLibrary-ee22030441e869a7c4ff632d27a7d45c6168a14e.tar.gz
Adding S32 Support to NEG operator in CLElementwiseUnaryLayer
Resolves : <COMPMID-3793> Signed-off-by: Suhail Munshi <MohammedSuhail.Munshi@arm.com> Change-Id: I4a6144ba788ae46d9637987455bec2dff8b6f561 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5586 Reviewed-by: Manuel Bottini <manuel.bottini@arm.com> Reviewed-by: Aleksandr Nikolaev <aleksandr.nikolaev@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--arm_compute/runtime/CL/functions/CLElementWiseUnaryLayer.h7
-rw-r--r--src/core/gpu/cl/kernels/ClElementwiseUnaryKernel.cpp4
-rw-r--r--tests/validation/CL/NegLayer.cpp11
3 files changed, 18 insertions, 4 deletions
diff --git a/arm_compute/runtime/CL/functions/CLElementWiseUnaryLayer.h b/arm_compute/runtime/CL/functions/CLElementWiseUnaryLayer.h
index 79b79e89de..594ee4cfdc 100644
--- a/arm_compute/runtime/CL/functions/CLElementWiseUnaryLayer.h
+++ b/arm_compute/runtime/CL/functions/CLElementWiseUnaryLayer.h
@@ -172,21 +172,22 @@ public:
* |:--------------|:--------------|
* |F16 |F16 |
* |F32 |F32 |
+ * |S32 |S32 |
*
- * @param[in] input Input tensor. Data types supported: F16/F32.
+ * @param[in] input Input tensor. Data types supported: F16/F32/S32
* @param[out] output Output tensor. Data types supported: same as @p input.
*/
void configure(const ICLTensor *input, ICLTensor *output);
/** Initialize the function
*
* @param[in] compile_context The compile context to be used.
- * @param[in] input Input tensor. Data types supported: F16/F32.
+ * @param[in] input Input tensor. Data types supported: F16/F32/S32
* @param[out] output Output tensor. Data types supported: same as @p input.
*/
void configure(const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *output);
/** Static function to check if given info will lead to a valid configuration of @ref CLNegLayer
*
- * @param[in] input First tensor input info. Data types supported: F16/F32.
+ * @param[in] input First tensor input info. Data types supported: F16/F32/S32
* @param[in] output Output tensor info. Data types supported: Same as @p input.
*
* @return a status
diff --git a/src/core/gpu/cl/kernels/ClElementwiseUnaryKernel.cpp b/src/core/gpu/cl/kernels/ClElementwiseUnaryKernel.cpp
index 8e9698cd50..5cbb3f2e38 100644
--- a/src/core/gpu/cl/kernels/ClElementwiseUnaryKernel.cpp
+++ b/src/core/gpu/cl/kernels/ClElementwiseUnaryKernel.cpp
@@ -45,6 +45,10 @@ Status validate_arguments(const ITensorInfo &src, const ITensorInfo &dst, const
{
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&src, 1, DataType::U8);
}
+ else if(op == ElementWiseUnary::NEG)
+ {
+ ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&src, 1, DataType::F16, DataType::F32, DataType::S32);
+ }
else
{
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&src, 1, DataType::F16, DataType::F32);
diff --git a/tests/validation/CL/NegLayer.cpp b/tests/validation/CL/NegLayer.cpp
index 690b8f44fb..01fa792543 100644
--- a/tests/validation/CL/NegLayer.cpp
+++ b/tests/validation/CL/NegLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 Arm Limited.
+ * Copyright (c) 2019-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -50,6 +50,15 @@ TEST_SUITE(NegLayer)
template <typename T>
using CLNegLayerFixture = NegValidationFixture<CLTensor, CLAccessor, CLNegLayer, T>;
+TEST_SUITE(S32)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLNegLayerFixture<int>, framework::DatasetMode::ALL, combine(datasets::SmallShapes(), framework::dataset::make("DataType",
+ DataType::S32)))
+{
+ // Validate output
+ validate(CLAccessor(_target), _reference);
+}
+TEST_SUITE_END()
+
TEST_SUITE(Float)
TEST_SUITE(FP16)
FIXTURE_DATA_TEST_CASE(RunSmall, CLNegLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), framework::dataset::make("DataType",