From 54d2376c6f994b06111522527c0f86f4e6b2aa71 Mon Sep 17 00:00:00 2001 From: Pablo Tello Date: Tue, 12 Feb 2019 11:09:48 +0000 Subject: COMPMID-1981: fixed Nightly DepthConcatenate QASMM8 mismatches Change-Id: Ibd72e03ffa6aa50543b3c410d6167231fdd16990 Signed-off-by: Pablo Tello Reviewed-on: https://review.mlplatform.org/662 Tested-by: Arm Jenkins Reviewed-by: VidhyaSudhan Loganathan --- .../validation/reference/DepthConcatenateLayer.cpp | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/validation/reference/DepthConcatenateLayer.cpp b/tests/validation/reference/DepthConcatenateLayer.cpp index 7775614171..f0dab3baac 100644 --- a/tests/validation/reference/DepthConcatenateLayer.cpp +++ b/tests/validation/reference/DepthConcatenateLayer.cpp @@ -51,20 +51,23 @@ SimpleTensor depthconcatenate_layer(const std::vector> &srcs, const int depth_out = dst.shape().z(); const int out_stride_z = width_out * height_out; const int batches = dst.shape().total_size_upper(3); - if(srcs[0].data_type() == DataType::QASYMM8 && srcs[0].quantization_info() != dst.quantization_info()) { - // input tensors can have smaller width and height than the output, so for each output's slice we need to requantize 0 (as this is the value - // used in NEFillBorderKernel by NEDepthConcatenateLayer) using the corresponding quantization info for that particular slice/input tensor. - int slice = 0; - for(const auto &src : srcs) + for(int b = 0; b < batches; ++b) { - auto ptr_slice = static_cast(dst(Coordinates(0, 0, slice))); - std::transform(ptr_slice, ptr_slice + dst.num_elements() / depth_out, ptr_slice, [src, dst](T t) + // input tensors can have smaller width and height than the output, so for each output's slice we need to requantize 0 (as this is the value + // used in NEFillBorderKernel by NEDepthConcatenateLayer) using the corresponding quantization info for that particular slice/input tensor. + int slice = 0; + for(const auto &src : srcs) { - return dst.quantization_info().quantize(src.quantization_info().dequantize(0), RoundingPolicy::TO_NEAREST_UP); - }); - slice += src.shape().z(); + auto ptr_slice = static_cast(dst(Coordinates(0, 0, slice, b))); + const auto num_elems_in_slice((dst.num_elements() / depth_out) * src.shape().z()); + std::transform(ptr_slice, ptr_slice + num_elems_in_slice, ptr_slice, [src, dst](T t) + { + return dst.quantization_info().quantize(src.quantization_info().dequantize(0), RoundingPolicy::TO_NEAREST_UP); + }); + slice += src.shape().z(); + } } } else -- cgit v1.2.1