From 4397b71f5e66f65761d378fc84cbce86d503a3d4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Shubham=20Gupta/SNAP=20/SRI-Bangalore/Engineer/=EC=82=BC?= =?utf8?q?=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 10 Dec 2018 07:26:28 +0530 Subject: [PATCH] Add validations for Neg op in CLKernel.cpp (#3931) This patch will add validations req to be tested before executing neg op Signed-off-by: shubham --- .../src/core/CL/kernels/CLNegKernel.cpp | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/libs/ARMComputeEx/src/core/CL/kernels/CLNegKernel.cpp b/libs/ARMComputeEx/src/core/CL/kernels/CLNegKernel.cpp index c122bfc..da75380 100644 --- a/libs/ARMComputeEx/src/core/CL/kernels/CLNegKernel.cpp +++ b/libs/ARMComputeEx/src/core/CL/kernels/CLNegKernel.cpp @@ -22,14 +22,31 @@ using namespace arm_compute; -CLNegKernel::CLNegKernel() : _input(nullptr), _output(nullptr) {} - -void CLNegKernel::configure(const ICLTensor *input, ICLTensor *output) +namespace +{ +Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output) { + ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8, DataType::S16, + DataType::S32, DataType::F16, DataType::F32); + ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::U8, DataType::S16, + DataType::S32, DataType::F16, DataType::F32); ARM_COMPUTE_ERROR_ON_MISMATCHING_DIMENSIONS(input->info()->tensor_shape(), output->info()->tensor_shape()); ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(input, output); + return Status{}; +} + +} // namespace + +CLNegKernel::CLNegKernel() : _input(nullptr), _output(nullptr) {} + +void CLNegKernel::configure(const ICLTensor *input, ICLTensor *output) +{ + + ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); + ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info())); + _input = input; _output = output; -- 2.7.4