From 97cf2497d2b617de3209330893ad51bd0cc126ce Mon Sep 17 00:00:00 2001 From: Sanghoon Lee Date: Mon, 29 Jan 2018 15:28:11 +0000 Subject: COMPMID-564: CustomConvolution issue fixed Change-Id: Ia2874d30780cb597a6e5039120815f2368911e0c Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/118024 Reviewed-by: Georgios Pinitas Tested-by: Jenkins Reviewed-by: Anthony Barbier --- tests/validation/reference/Convolution.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'tests/validation/reference/Convolution.cpp') diff --git a/tests/validation/reference/Convolution.cpp b/tests/validation/reference/Convolution.cpp index 308c0b5a87..5d0cf1ea93 100644 --- a/tests/validation/reference/Convolution.cpp +++ b/tests/validation/reference/Convolution.cpp @@ -43,22 +43,25 @@ SimpleTensor convolution(const SimpleTensor &src, DataType output_da SimpleTensor dst(src.shape(), output_data_type); - for(int element_idx = 0; element_idx < src.num_elements(); ++element_idx) + switch(output_data_type) { - const Coordinates id = index2coord(src.shape(), element_idx); - - switch(output_data_type) + case DataType::S16: { - case DataType::S16: + SimpleTensor sum(src.shape(), output_data_type); + for(int element_idx = 0; element_idx < src.num_elements(); ++element_idx) { - SimpleTensor sum(src.shape(), output_data_type); + const Coordinates id = index2coord(src.shape(), element_idx); apply_2d_spatial_filter(id, src, sum, TensorShape(width, height), conv, 1 / static_cast(scale), border_mode, constant_border_value); dst[element_idx] = tensor_elem_at(sum, id, border_mode, constant_border_value); } - break; - case DataType::U8: + } + break; + case DataType::U8: + { + SimpleTensor sum(src.shape(), output_data_type); + for(int element_idx = 0; element_idx < src.num_elements(); ++element_idx) { - SimpleTensor sum(src.shape(), output_data_type); + const Coordinates id = index2coord(src.shape(), element_idx); apply_2d_spatial_filter(id, src, sum, TensorShape(width, height), conv, 1, border_mode, constant_border_value); if(tensor_elem_at(sum, id, border_mode, constant_border_value) < 0) { @@ -73,13 +76,12 @@ SimpleTensor convolution(const SimpleTensor &src, DataType output_da dst[element_idx] = tensor_elem_at(sum, id, border_mode, constant_border_value) / scale; } } - break; - default: - ARM_COMPUTE_ERROR("Not supported DataType"); - break; } + break; + default: + ARM_COMPUTE_ERROR("Not supported DataType"); + break; } - return dst; } -- cgit v1.2.1