diff options
-rw-r--r-- | arm_compute/runtime/CL/functions/CLElementWiseUnaryLayer.h | 7 | ||||
-rw-r--r-- | src/core/gpu/cl/kernels/ClElementwiseUnaryKernel.cpp | 4 | ||||
-rw-r--r-- | tests/validation/CL/NegLayer.cpp | 11 |
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", |