From 5323de6348f81c7fee83b2e44841f37f720cad1e Mon Sep 17 00:00:00 2001 From: Pablo Tello Date: Mon, 11 Feb 2019 17:03:15 +0000 Subject: COMPMID-1918: Fixed mismatches in NEDepthConcatenateLayer Change-Id: I8d1d65297f30d11cf2e62539d7a823ed8e409cf0 Signed-off-by: Pablo Tello Reviewed-on: https://review.mlplatform.org/660 Tested-by: Arm Jenkins Reviewed-by: Isabella Gottardi --- .../validation/reference/DepthConcatenateLayer.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/validation/reference/DepthConcatenateLayer.cpp b/tests/validation/reference/DepthConcatenateLayer.cpp index 6551f0c79e..7775614171 100644 --- a/tests/validation/reference/DepthConcatenateLayer.cpp +++ b/tests/validation/reference/DepthConcatenateLayer.cpp @@ -52,8 +52,25 @@ SimpleTensor depthconcatenate_layer(const std::vector> &srcs, const int out_stride_z = width_out * height_out; const int batches = dst.shape().total_size_upper(3); - // Set output tensor to 0 - std::fill_n(dst.data(), dst.num_elements(), 0); + 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) + { + 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) + { + return dst.quantization_info().quantize(src.quantization_info().dequantize(0), RoundingPolicy::TO_NEAREST_UP); + }); + slice += src.shape().z(); + } + } + else + { + std::fill_n(dst.data(), dst.num_elements(), 0); + } for(const auto &src : srcs) { -- cgit v1.2.1