aboutsummaryrefslogtreecommitdiff
path: root/tests/validation
diff options
context:
space:
mode:
Diffstat (limited to 'tests/validation')
-rw-r--r--tests/validation/NEON/Gather.cpp12
-rw-r--r--tests/validation/reference/Gather.cpp41
2 files changed, 17 insertions, 36 deletions
diff --git a/tests/validation/NEON/Gather.cpp b/tests/validation/NEON/Gather.cpp
index 1ab2668aad..71f98ea627 100644
--- a/tests/validation/NEON/Gather.cpp
+++ b/tests/validation/NEON/Gather.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2021 Arm Limited.
+ * Copyright (c) 2019-2022 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -100,14 +100,12 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
template <typename T>
using NEGatherFixture = GatherFixture<Tensor, Accessor, NEGather, T>;
-const auto gather_small_shapes = arm_compute::test::framework::dataset::concat(datasets::SmallGatherDataset(),datasets::SmallGatherMultiDimIndicesDataset());
-
TEST_SUITE(Float)
TEST_SUITE(FP16)
FIXTURE_DATA_TEST_CASE(RunSmall,
NEGatherFixture<half>,
framework::DatasetMode::PRECOMMIT,
- combine( gather_small_shapes, framework::dataset::make("DataType", DataType::F16)))
+ combine(datasets::SmallGatherDataset(), framework::dataset::make("DataType", DataType::F16)))
{
// Validate output
validate(Accessor(_target), _reference);
@@ -127,7 +125,7 @@ TEST_SUITE(FP32)
FIXTURE_DATA_TEST_CASE(RunSmall,
NEGatherFixture<float>,
framework::DatasetMode::PRECOMMIT,
- combine(gather_small_shapes, framework::dataset::make("DataType", DataType::F32)))
+ combine(datasets::SmallGatherDataset(), framework::dataset::make("DataType", DataType::F32)))
{
// Validate output
validate(Accessor(_target), _reference);
@@ -148,7 +146,7 @@ TEST_SUITE(U8)
FIXTURE_DATA_TEST_CASE(RunSmall,
NEGatherFixture<uint8_t>,
framework::DatasetMode::PRECOMMIT,
- combine(gather_small_shapes, framework::dataset::make("DataType", DataType::U8)))
+ combine(datasets::SmallGatherDataset(), framework::dataset::make("DataType", DataType::U8)))
{
// Validate output
validate(Accessor(_target), _reference);
@@ -168,7 +166,7 @@ TEST_SUITE(U16)
FIXTURE_DATA_TEST_CASE(RunSmall,
NEGatherFixture<uint16_t>,
framework::DatasetMode::PRECOMMIT,
- combine(gather_small_shapes, framework::dataset::make("DataType", DataType::U16)))
+ combine(datasets::SmallGatherDataset(), framework::dataset::make("DataType", DataType::U16)))
{
// Validate output
validate(Accessor(_target), _reference);
diff --git a/tests/validation/reference/Gather.cpp b/tests/validation/reference/Gather.cpp
index 02292fb74e..c26438857f 100644
--- a/tests/validation/reference/Gather.cpp
+++ b/tests/validation/reference/Gather.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, 2022 Arm Limited.
+ * Copyright (c) 2018-2022 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -45,39 +45,22 @@ SimpleTensor<T> gather(const SimpleTensor<T> &src, const SimpleTensor<uint32_t>
Window win;
win.use_tensor_dimensions(dst_shape);
- if(indices.shape().num_dimensions() == 1u)
+ execute_window_loop(win, [&](const Coordinates & id)
{
- execute_window_loop(win, [&](const Coordinates & id)
+ Coordinates offset;
+ for(unsigned int dim = 0; dim < id.num_dimensions(); ++dim)
{
- Coordinates offset;
- for(unsigned int dim = 0; dim < id.num_dimensions(); ++dim)
+ if(dim == actual_axis)
{
- if(dim == actual_axis)
- {
- offset.set(dim, indices_ptr[id[dim]]);
- }
- else
- {
- offset.set(dim, id[dim]);
- }
+ offset.set(dim, indices_ptr[id[dim]]);
}
- *reinterpret_cast<T *>(dst(id)) = *reinterpret_cast<const T *>(src(offset));
- });
- }
- else
- {
- if(actual_axis == 0)
- {
- win.set(Window::DimX, Window::Dimension(0, 1, 1));
- uint32_t index = 0;
- execute_window_loop(win, [&](const Coordinates & id)
+ else
{
- auto *dst_ptr = reinterpret_cast<T *>(dst(id));
- const int row_to_copy = indices[index++];
- std::copy_n(src.data() + row_to_copy * src.shape()[0], src.shape()[0], dst_ptr);
- });
+ offset.set(dim, id[dim]);
+ }
}
- }
+ *reinterpret_cast<T *>(dst(id)) = *reinterpret_cast<const T *>(src(offset));
+ });
return dst;
}
@@ -89,4 +72,4 @@ template SimpleTensor<uint8_t> gather(const SimpleTensor<uint8_t> &src, const Si
} // namespace reference
} // namespace validation
} // namespace test
-} // namespace arm_compute
+} // namespace arm_compute \ No newline at end of file