diff options
author | Pablo Tello <pablo.tello@arm.com> | 2019-02-11 17:03:15 +0000 |
---|---|---|
committer | Isabella Gottardi <isabella.gottardi@arm.com> | 2019-02-11 17:49:46 +0000 |
commit | 661c252bdaf272e1d574ba3fdf05868e50a8d858 (patch) | |
tree | 73990397cdc465ce6820c2ce638ea43b59a4af5a /tests/validation/reference/DepthConcatenateLayer.cpp | |
parent | 6844b8800128d27b469ae4905756deea90dd791c (diff) | |
download | ComputeLibrary-661c252bdaf272e1d574ba3fdf05868e50a8d858.tar.gz |
COMPMID-1918: Fixed mismatches in NEDepthConcatenateLayer
Change-Id: I8d1d65297f30d11cf2e62539d7a823ed8e409cf0
Signed-off-by: Pablo Tello <pablo.tello@arm.com>
Reviewed-on: https://review.mlplatform.org/660
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Isabella Gottardi <isabella.gottardi@arm.com>
Diffstat (limited to 'tests/validation/reference/DepthConcatenateLayer.cpp')
-rw-r--r-- | tests/validation/reference/DepthConcatenateLayer.cpp | 21 |
1 files 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<T> depthconcatenate_layer(const std::vector<SimpleTensor<T>> &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<T *>(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) { |