From 1bda68db7eec2f5bc19b6d0b6b1733ecca778c45 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Shubham=20Gupta/System=20SW=20/SRI-Bangalore/Engineer/?= =?utf8?q?=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Fri, 26 Oct 2018 13:56:16 +0530 Subject: [PATCH] Correcting and adding arm_compute assertions in CL core/kernel files (#3312) This patch will add more asertions required to be tested and corrects the wrong assertions that have been added. Signed-off-by: shubham --- .../src/core/CL/kernels/CLBatchToSpaceNDKernel.cpp | 13 ++++++++++--- .../src/core/CL/kernels/CLSpaceToDepthKernel.cpp | 5 +++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/libs/ARMComputeEx/src/core/CL/kernels/CLBatchToSpaceNDKernel.cpp b/libs/ARMComputeEx/src/core/CL/kernels/CLBatchToSpaceNDKernel.cpp index f8d7248..2ed4dc4 100644 --- a/libs/ARMComputeEx/src/core/CL/kernels/CLBatchToSpaceNDKernel.cpp +++ b/libs/ARMComputeEx/src/core/CL/kernels/CLBatchToSpaceNDKernel.cpp @@ -52,9 +52,16 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, output->dimension(3) * block_size[0] * block_size[1] == input->dimension(3), "Input batch should be equal to (output batch * block size[0] *block size[1])"); - ARM_COMPUTE_RETURN_ERROR_ON_MSG(!(input->dimension(0) % block_size[1]) && - !(input->dimension(1) % block_size[0]), - "Input height and width should be divisible by block size"); + ARM_COMPUTE_RETURN_ERROR_ON_MSG(!(output->dimension(0) % block_size[1]) && + !(output->dimension(1) % block_size[0]), + "Output height and width should be divisible by block size[0] " + "and block_size[1] respectively"); + + ARM_COMPUTE_RETURN_ERROR_ON_MSG((output->dimension(0) == input->dimension(0) * block_size[1]) && + (output->dimension(1) == input->dimension(1) * block_size[0]), + "Output height and width should be equal to " + "input_height*blocksize[0] and input_width*blocksize[1] " + "respectively"); return Status{}; } diff --git a/libs/ARMComputeEx/src/core/CL/kernels/CLSpaceToDepthKernel.cpp b/libs/ARMComputeEx/src/core/CL/kernels/CLSpaceToDepthKernel.cpp index dd23078..871b559 100644 --- a/libs/ARMComputeEx/src/core/CL/kernels/CLSpaceToDepthKernel.cpp +++ b/libs/ARMComputeEx/src/core/CL/kernels/CLSpaceToDepthKernel.cpp @@ -56,6 +56,11 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, !(input->dimension(1) % block_size), "Input height and width should be divisible by block size"); + ARM_COMPUTE_RETURN_ERROR_ON_MSG((output->dimension(0) == (input->dimension(0) / block_size)) && + (output->dimension(1) == (input->dimension(1) / block_size)), + "Output height and width should be equal to " + "input_height/blocksize and input_width/blocksize respectively"); + return Status{}; } -- 2.7.4