Correcting and adding arm_compute assertions in CL core/kernel files (#3312)
authorShubham Gupta/System SW /SRI-Bangalore/Engineer/삼성전자 <shub98.gupta@samsung.com>
Fri, 26 Oct 2018 08:26:16 +0000 (13:56 +0530)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Fri, 26 Oct 2018 08:26:16 +0000 (17:26 +0900)
This patch will add more asertions required to be tested and corrects the wrong assertions that have been added.

Signed-off-by: shubham <shub98.gupta@samsung.com>
libs/ARMComputeEx/src/core/CL/kernels/CLBatchToSpaceNDKernel.cpp
libs/ARMComputeEx/src/core/CL/kernels/CLSpaceToDepthKernel.cpp

index f8d7248..2ed4dc4 100644 (file)
@@ -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{};
 }
index dd23078..871b559 100644 (file)
@@ -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{};
 }