diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2018-12-28 16:32:49 +0000 |
---|---|---|
committer | Michalis Spyrou <michalis.spyrou@arm.com> | 2019-01-08 17:21:17 +0000 |
commit | 110b920510a4b4c0edbf9859070a506c438f67b9 (patch) | |
tree | 0d2143097a822029754ff9160a1dbea6e6415e75 /tests/validation/fixtures | |
parent | 520bdff55e2c273ff60b6d00d8ddb750a4bd2d56 (diff) | |
download | ComputeLibrary-110b920510a4b4c0edbf9859070a506c438f67b9.tar.gz |
COMPMID-1759 NEON: Implement Reverse
Change-Id: I53852069ca223eb571a443e501278980fc60f3b4
Reviewed-on: https://review.mlplatform.org/474
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Diffstat (limited to 'tests/validation/fixtures')
-rw-r--r-- | tests/validation/fixtures/ReverseFixture.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/tests/validation/fixtures/ReverseFixture.h b/tests/validation/fixtures/ReverseFixture.h index 172357c4b7..ed5253d041 100644 --- a/tests/validation/fixtures/ReverseFixture.h +++ b/tests/validation/fixtures/ReverseFixture.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -58,11 +58,13 @@ protected: { library->fill_tensor_uniform(tensor, 0); } - template <typename U> - void fill_axis(U &&tensor) + std::vector<int> generate_random_axis() { - std::uniform_int_distribution<> distribution(0, 3); - library->fill(tensor, distribution, 0); + std::vector<int> axis_v = { 0, 1, 2, 3 }; + std::mt19937 g(0); + std::shuffle(axis_v.begin(), axis_v.end(), g); + + return axis_v; } TensorType compute_target(const TensorShape &shape, const TensorShape &axis_shape, DataType data_type) @@ -91,7 +93,11 @@ protected: // Fill tensors fill(AccessorType(src)); - fill_axis(AccessorType(axis)); + { + auto axis_data = AccessorType(axis); + auto axis_v = generate_random_axis(); + std::copy(axis_v.begin(), axis_v.begin() + axis_shape.x(), static_cast<int32_t *>(axis_data.data())); + } // Compute function reverse_func.run(); @@ -107,7 +113,8 @@ protected: // Fill reference fill(src); - fill_axis(axis); + auto axis_v = generate_random_axis(); + std::copy(axis_v.begin(), axis_v.begin() + axis_shape.x(), axis.data()); return reference::reverse<T>(src, axis); } |