diff options
author | Pablo Tello <pablo.tello@arm.com> | 2018-01-23 08:31:41 +0000 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:45:00 +0000 |
commit | fc1ffe626278e75ba11c803280a6ef46a5bd1ad6 (patch) | |
tree | 4572cd84868fe0322884113b85575bff942ae924 /tests/validation/reference/Remap.cpp | |
parent | 4df057551194ba079731f097ce840cc320353199 (diff) | |
download | ComputeLibrary-fc1ffe626278e75ba11c803280a6ef46a5bd1ad6.tar.gz |
COMPMID-837: Fixed remap tests failures in Valgrind.
Some minor improvements in the test fixture, for example making sure
the values in the mapx and mapy tensors are in the range of [-5, in_width+5]
and [-5,in_height].
Tolerance was changed to 0, no mismatches expected.
Change-Id: I2fad06defb293bf9fdd1988799b19547c102dee5
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/118044
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests/validation/reference/Remap.cpp')
-rw-r--r-- | tests/validation/reference/Remap.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/validation/reference/Remap.cpp b/tests/validation/reference/Remap.cpp index bef5962fbf..f862c13700 100644 --- a/tests/validation/reference/Remap.cpp +++ b/tests/validation/reference/Remap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -42,16 +42,15 @@ SimpleTensor<T> remap(const SimpleTensor<T> &in, SimpleTensor<float> &map_x, Sim T constant_border_value) { ARM_COMPUTE_ERROR_ON_MSG(border_mode == BorderMode::REPLICATE, "BorderMode not supported"); - SimpleTensor<T> out(in.shape(), in.data_type()); - + ARM_COMPUTE_ERROR_ON(out.num_elements() != map_x.num_elements()); const int width = in.shape().x(); const int height = in.shape().y(); - for(int idx = 0; idx < out.num_elements(); idx++) { - valid_mask[idx] = 1; - Coordinates src_idx; + const Coordinates id_out = index2coord(out.shape(), idx); + valid_mask[idx] = 1; + Coordinates src_idx = id_out; // need to setup all coordinates and not just xy src_idx.set(0, static_cast<int>(std::floor(map_x[idx]))); src_idx.set(1, static_cast<int>(std::floor(map_y[idx]))); if((0 <= map_y[idx]) && (map_y[idx] < height) && (0 <= map_x[idx]) && (map_x[idx] < width)) @@ -59,11 +58,17 @@ SimpleTensor<T> remap(const SimpleTensor<T> &in, SimpleTensor<float> &map_x, Sim switch(policy) { case InterpolationPolicy::NEAREST_NEIGHBOR: + { out[idx] = tensor_elem_at(in, src_idx, border_mode, constant_border_value); break; + } case InterpolationPolicy::BILINEAR: - (valid_bilinear_policy(map_x[idx], map_y[idx], width, height, border_mode)) ? out[idx] = bilinear_policy(in, src_idx, map_x[idx], map_y[idx], border_mode, constant_border_value) : valid_mask[idx] = 0; + { + (valid_bilinear_policy(map_x[idx], map_y[idx], width, height, border_mode)) ? + out[idx] = bilinear_policy(in, src_idx, map_x[idx], map_y[idx], border_mode, constant_border_value) : + valid_mask[idx] = 0; break; + } case InterpolationPolicy::AREA: default: ARM_COMPUTE_ERROR("Interpolation not supported"); |