aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/fixtures/GatherFixture.h
diff options
context:
space:
mode:
authorViet-Hoa Do <viet-hoa.do@arm.com>2023-03-15 16:52:05 +0000
committerViet-Hoa Do <viet-hoa.do@arm.com>2023-04-28 13:16:39 +0000
commita25582c4e7dddd26419e0a3316614e8309928934 (patch)
tree3e71a83870f561d2abb8df802c56009224628152 /tests/validation/fixtures/GatherFixture.h
parenteaae8999ac8027a5fb96162061ad8ccc490515cb (diff)
downloadComputeLibrary-a25582c4e7dddd26419e0a3316614e8309928934.tar.gz
Fix the gather layer indices check
* If the index is out-of-bound, both CPU and GPU implementations of the gather layer will output 0. Resolves: COMPMID-5964 Signed-off-by: Viet-Hoa Do <viet-hoa.do@arm.com> Change-Id: Ib029b3acfb31452f2097c8c75448fb2697cfa332 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9487 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Pablo Marquez Tello <pablo.tello@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/fixtures/GatherFixture.h')
-rw-r--r--tests/validation/fixtures/GatherFixture.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/validation/fixtures/GatherFixture.h b/tests/validation/fixtures/GatherFixture.h
index 452a201f82..f6f70023b9 100644
--- a/tests/validation/fixtures/GatherFixture.h
+++ b/tests/validation/fixtures/GatherFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2021 Arm Limited.
+ * Copyright (c) 2018-2021, 2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -67,7 +67,10 @@ protected:
std::mt19937 gen(library->seed());
uint32_t *indices_ptr = static_cast<uint32_t *>(indices.data());
- std::uniform_int_distribution<uint32_t> dist_index(0, input_shape[actual_axis] - 1);
+ // 10% of the time the index is out-of-range.
+ uint32_t max_index = input_shape[actual_axis] + input_shape[actual_axis] / 9 + 1;
+
+ std::uniform_int_distribution<uint32_t> dist_index(0, max_index - 1);
//Let's consider 1D indices
for(unsigned int ind = 0; ind < indices_shape[0]; ind++)
{