aboutsummaryrefslogtreecommitdiff
path: root/tests/validation
diff options
context:
space:
mode:
authorPablo Tello <pablo.tello@arm.com>2018-12-05 17:36:30 +0000
committerGeorgios Pinitas <georgios.pinitas@arm.com>2018-12-12 18:48:48 +0000
commit35767bc09f21050a9767a91b086b327afc928a81 (patch)
tree0b4b3dad94566ae3c52f847103b2577ada5dd06d /tests/validation
parent1f8db2be160718979d38e3671a135d22e83cc5c2 (diff)
downloadComputeLibrary-35767bc09f21050a9767a91b086b327afc928a81.tar.gz
COMPMID-1697: NEPermute extended support for more cases.
Regardless the input data layout NEPermute function has been added support for the all the permutations of 4d tensors Added corresponding validation tests. Change-Id: I0f8f20c2c3716e908a18a59783be53efab80ef5b Reviewed-on: https://review.mlplatform.org/367 Reviewed-by: Giuseppe Rossini <giuseppe.rossini@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation')
-rw-r--r--tests/validation/CL/Permute.cpp14
-rw-r--r--tests/validation/CPP/Permute.cpp39
-rw-r--r--tests/validation/NEON/Permute.cpp61
-rw-r--r--tests/validation/fixtures/PermuteFixture.h18
4 files changed, 97 insertions, 35 deletions
diff --git a/tests/validation/CL/Permute.cpp b/tests/validation/CL/Permute.cpp
index 1371e717e7..a75b8cf9cd 100644
--- a/tests/validation/CL/Permute.cpp
+++ b/tests/validation/CL/Permute.cpp
@@ -42,10 +42,16 @@ namespace validation
{
namespace
{
-const auto PermuteParametersSmall = combine(datasets::Small4DShapes(),
- framework::dataset::make("PermutationVector", { PermutationVector(2U, 0U, 1U), PermutationVector(1U, 2U, 0U), PermutationVector(3U, 2U, 0U, 1U) }));
-const auto PermuteParametersLarge = combine(datasets::Large4DShapes(),
- framework::dataset::make("PermutationVector", { PermutationVector(2U, 0U, 1U), PermutationVector(1U, 2U, 0U), PermutationVector(3U, 2U, 0U, 1U) }));
+const auto PermuteVectors = framework::dataset::make("PermutationVector",
+{
+ PermutationVector(2U, 0U, 1U),
+ PermutationVector(1U, 2U, 0U),
+ PermutationVector(3U, 2U, 0U, 1U)
+});
+const auto PermuteInputLayout = framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC });
+const auto PermuteParametersSmall = concat(concat(datasets::Small2DShapes(), datasets::Small3DShapes()), datasets::Small4DShapes()) * PermuteInputLayout * PermuteVectors;
+const auto PermuteParametersLarge = datasets::Large4DShapes() * PermuteInputLayout * PermuteVectors;
+
} // namespace
TEST_SUITE(CL)
TEST_SUITE(Permute)
diff --git a/tests/validation/CPP/Permute.cpp b/tests/validation/CPP/Permute.cpp
index 0a97041f81..2ba10ec651 100644
--- a/tests/validation/CPP/Permute.cpp
+++ b/tests/validation/CPP/Permute.cpp
@@ -42,10 +42,19 @@ namespace validation
{
namespace
{
-const auto PermuteParametersSmall = combine(concat(concat(datasets::Small2DShapes(), datasets::Small3DShapes()), datasets::Small4DShapes()),
- framework::dataset::make("PermutationVector", { PermutationVector(2U, 0U, 1U), PermutationVector(1U, 2U, 0U), PermutationVector(3U, 2U, 0U, 1U) }));
-const auto PermuteParametersLarge = combine(datasets::Large4DShapes(),
- framework::dataset::make("PermutationVector", { PermutationVector(2U, 0U, 1U), PermutationVector(1U, 2U, 0U), PermutationVector(3U, 2U, 0U, 1U) }));
+const auto PermuteVectors = framework::dataset::make("PermutationVector",
+{
+ PermutationVector(2U, 0U, 1U),
+ PermutationVector(1U, 2U, 0U),
+ PermutationVector(0U, 1U, 2U),
+ PermutationVector(0U, 2U, 1U),
+ PermutationVector(1U, 0U, 2U),
+ PermutationVector(2U, 1U, 0U),
+});
+const auto PermuteInputLayout = framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC });
+const auto PermuteParametersSmall = concat(concat(datasets::Small2DShapes(), datasets::Small3DShapes()), datasets::Small4DShapes()) * PermuteInputLayout * PermuteVectors;
+const auto PermuteParametersLarge = datasets::Large4DShapes() * PermuteInputLayout * PermuteVectors;
+
} // namespace
TEST_SUITE(CPP)
TEST_SUITE(Permute)
@@ -77,25 +86,32 @@ template <typename T>
using CPPPermuteFixture = PermuteValidationFixture<Tensor, Accessor, CPPPermute, T>;
TEST_SUITE(U8)
-FIXTURE_DATA_TEST_CASE(RunSmall, CPPPermuteFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(PermuteParametersSmall, framework::dataset::make("DataType", DataType::U8)))
+FIXTURE_DATA_TEST_CASE(RunSmall, CPPPermuteFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
+ PermuteParametersSmall * framework::dataset::make("DataType", DataType::U8))
{
// Validate output
validate(Accessor(_target), _reference);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, CPPPermuteFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(PermuteParametersLarge, framework::dataset::make("DataType", DataType::U8)))
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CPPPermuteFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
+ PermuteParametersLarge * framework::dataset::make("DataType", DataType::U8))
{
// Validate output
validate(Accessor(_target), _reference);
}
+
TEST_SUITE_END()
TEST_SUITE(U16)
-FIXTURE_DATA_TEST_CASE(RunSmall, CPPPermuteFixture<uint16_t>, framework::DatasetMode::PRECOMMIT, combine(PermuteParametersSmall, framework::dataset::make("DataType", DataType::U16)))
+FIXTURE_DATA_TEST_CASE(RunSmall, CPPPermuteFixture<uint16_t>, framework::DatasetMode::PRECOMMIT,
+ PermuteParametersSmall * framework::dataset::make("DataType", DataType::U16))
{
// Validate output
validate(Accessor(_target), _reference);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, CPPPermuteFixture<uint16_t>, framework::DatasetMode::NIGHTLY, combine(PermuteParametersLarge, framework::dataset::make("DataType", DataType::U16)))
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CPPPermuteFixture<uint16_t>, framework::DatasetMode::NIGHTLY,
+ PermuteParametersLarge * framework::dataset::make("DataType", DataType::U16))
{
// Validate output
validate(Accessor(_target), _reference);
@@ -103,12 +119,15 @@ FIXTURE_DATA_TEST_CASE(RunLarge, CPPPermuteFixture<uint16_t>, framework::Dataset
TEST_SUITE_END()
TEST_SUITE(U32)
-FIXTURE_DATA_TEST_CASE(RunSmall, CPPPermuteFixture<uint32_t>, framework::DatasetMode::PRECOMMIT, combine(PermuteParametersSmall, framework::dataset::make("DataType", DataType::U32)))
+FIXTURE_DATA_TEST_CASE(RunSmall, CPPPermuteFixture<uint32_t>, framework::DatasetMode::PRECOMMIT,
+ PermuteParametersSmall * framework::dataset::make("DataType", DataType::U32))
{
// Validate output
validate(Accessor(_target), _reference);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, CPPPermuteFixture<uint32_t>, framework::DatasetMode::NIGHTLY, combine(PermuteParametersLarge, framework::dataset::make("DataType", DataType::U32)))
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CPPPermuteFixture<uint32_t>, framework::DatasetMode::NIGHTLY,
+ PermuteParametersLarge * framework::dataset::make("DataType", DataType::U32))
{
// Validate output
validate(Accessor(_target), _reference);
diff --git a/tests/validation/NEON/Permute.cpp b/tests/validation/NEON/Permute.cpp
index 8c172ddded..a5a81b7ac3 100644
--- a/tests/validation/NEON/Permute.cpp
+++ b/tests/validation/NEON/Permute.cpp
@@ -42,10 +42,29 @@ namespace validation
{
namespace
{
-const auto PermuteParametersSmall = combine(concat(concat(datasets::Small2DShapes(), datasets::Small3DShapes()), datasets::Small4DShapes()),
- framework::dataset::make("PermutationVector", { PermutationVector(2U, 0U, 1U), PermutationVector(1U, 2U, 0U) }));
-const auto PermuteParametersLarge = combine(datasets::Large4DShapes(),
- framework::dataset::make("PermutationVector", { PermutationVector(2U, 0U, 1U), PermutationVector(1U, 2U, 0U) }));
+const auto PermuteVectors3 = framework::dataset::make("PermutationVector",
+{
+ PermutationVector(2U, 0U, 1U),
+ PermutationVector(1U, 2U, 0U),
+ PermutationVector(0U, 1U, 2U),
+ PermutationVector(0U, 2U, 1U),
+ PermutationVector(1U, 0U, 2U),
+ PermutationVector(2U, 1U, 0U),
+});
+const auto PermuteVectors4 = framework::dataset::make("PermutationVector",
+{
+ PermutationVector(3U, 2U, 0U, 1U),
+ PermutationVector(3U, 2U, 1U, 0U),
+ PermutationVector(2U, 3U, 1U, 0U),
+ PermutationVector(1U, 3U, 2U, 0U),
+ PermutationVector(3U, 1U, 2U, 0U),
+ PermutationVector(3U, 0U, 2U, 1U),
+ PermutationVector(0U, 3U, 2U, 1U)
+});
+const auto PermuteVectors = concat(PermuteVectors3, PermuteVectors4);
+const auto PermuteInputLayout = framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC });
+const auto PermuteParametersSmall = concat(concat(datasets::Small2DShapes(), datasets::Small3DShapes()), datasets::Small4DShapes()) * PermuteInputLayout * PermuteVectors;
+const auto PermuteParametersLarge = datasets::Large4DShapes() * PermuteInputLayout * PermuteVectors;
} // namespace
TEST_SUITE(NEON)
TEST_SUITE(Permute)
@@ -61,7 +80,11 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
TensorInfo(TensorShape(7U, 7U, 5U, 3U), 1, DataType::U16), // valid
TensorInfo(TensorShape(27U, 13U, 37U, 2U), 1, DataType::F32), // valid
TensorInfo(TensorShape(7U, 7U, 5U, 3U), 1, DataType::U16), // permutation not supported
+ TensorInfo(TensorShape(7U, 7U, 5U, 3U), 1, DataType::S16), // permutation not supported
TensorInfo(TensorShape(27U, 13U, 37U, 2U), 1, DataType::F32), // permutation not supported
+ TensorInfo(TensorShape(27U, 13U, 37U, 2U), 1, DataType::F32), // permutation not supported
+ TensorInfo(TensorShape(27U, 13U, 37U, 2U), 1, DataType::F32) // permutation not supported
+
}),
framework::dataset::make("OutputInfo", {
TensorInfo(TensorShape(5U, 7U, 7U, 3U), 1, DataType::U16),
@@ -71,7 +94,11 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
TensorInfo(TensorShape(5U, 7U, 7U, 3U), 1, DataType::U16),
TensorInfo(TensorShape(13U, 37U, 27U, 2U), 1, DataType::F32),
TensorInfo(TensorShape(5U, 7U, 7U, 3U), 1, DataType::U16),
+ TensorInfo(TensorShape(3U, 5U, 7U, 7U), 1, DataType::S16),
TensorInfo(TensorShape(13U, 37U, 27U, 2U), 1, DataType::F32),
+ TensorInfo(TensorShape(37U, 2U, 13U, 27U), 1, DataType::F32),
+ TensorInfo(TensorShape(37U, 2U, 13U, 27U), 1, DataType::F32)
+
})),
framework::dataset::make("PermutationVector", {
PermutationVector(2U, 1U, 0U),
@@ -81,9 +108,12 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
PermutationVector(2U, 0U, 1U),
PermutationVector(1U, 2U, 0U),
PermutationVector(3U, 2U, 0U, 1U),
- PermutationVector(2U, 3U, 1U, 0U)
+ PermutationVector(3U, 2U, 0U, 1U),
+ PermutationVector(2U, 3U, 1U, 0U),
+ PermutationVector(2U, 3U, 1U, 0U),
+ PermutationVector(0U, 0U, 0U, 1000U)
})),
- framework::dataset::make("Expected", { false, false, false, false, true, true, false, false })),
+ framework::dataset::make("Expected", { true, false, false, false, true, true, false,true, false, true, false })),
input_info, output_info, perm_vect, expected)
{
ARM_COMPUTE_EXPECT(bool(NEPermute::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), perm_vect)) == expected, framework::LogLevel::ERRORS);
@@ -118,12 +148,15 @@ template <typename T>
using NEPermuteFixture = PermuteValidationFixture<Tensor, Accessor, NEPermute, T>;
TEST_SUITE(U8)
-FIXTURE_DATA_TEST_CASE(RunSmall, NEPermuteFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(PermuteParametersSmall, framework::dataset::make("DataType", DataType::U8)))
+FIXTURE_DATA_TEST_CASE(RunSmall, NEPermuteFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
+ PermuteParametersSmall * framework::dataset::make("DataType", DataType::U8))
{
// Validate output
validate(Accessor(_target), _reference);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, NEPermuteFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(PermuteParametersLarge, framework::dataset::make("DataType", DataType::U8)))
+
+FIXTURE_DATA_TEST_CASE(RunLarge, NEPermuteFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
+ PermuteParametersLarge * framework::dataset::make("DataType", DataType::U8))
{
// Validate output
validate(Accessor(_target), _reference);
@@ -131,12 +164,14 @@ FIXTURE_DATA_TEST_CASE(RunLarge, NEPermuteFixture<uint8_t>, framework::DatasetMo
TEST_SUITE_END()
TEST_SUITE(U16)
-FIXTURE_DATA_TEST_CASE(RunSmall, NEPermuteFixture<uint16_t>, framework::DatasetMode::PRECOMMIT, combine(PermuteParametersSmall, framework::dataset::make("DataType", DataType::U16)))
+FIXTURE_DATA_TEST_CASE(RunSmall, NEPermuteFixture<uint16_t>, framework::DatasetMode::PRECOMMIT,
+ PermuteParametersSmall * framework::dataset::make("DataType", DataType::U16))
{
// Validate output
validate(Accessor(_target), _reference);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, NEPermuteFixture<uint16_t>, framework::DatasetMode::NIGHTLY, combine(PermuteParametersLarge, framework::dataset::make("DataType", DataType::U16)))
+FIXTURE_DATA_TEST_CASE(RunLarge, NEPermuteFixture<uint16_t>, framework::DatasetMode::NIGHTLY,
+ PermuteParametersLarge * framework::dataset::make("DataType", DataType::U16))
{
// Validate output
validate(Accessor(_target), _reference);
@@ -144,12 +179,14 @@ FIXTURE_DATA_TEST_CASE(RunLarge, NEPermuteFixture<uint16_t>, framework::DatasetM
TEST_SUITE_END()
TEST_SUITE(U32)
-FIXTURE_DATA_TEST_CASE(RunSmall, NEPermuteFixture<uint32_t>, framework::DatasetMode::PRECOMMIT, combine(PermuteParametersSmall, framework::dataset::make("DataType", DataType::U32)))
+FIXTURE_DATA_TEST_CASE(RunSmall, NEPermuteFixture<uint32_t>, framework::DatasetMode::PRECOMMIT,
+ PermuteParametersSmall * framework::dataset::make("DataType", DataType::U32))
{
// Validate output
validate(Accessor(_target), _reference);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, NEPermuteFixture<uint32_t>, framework::DatasetMode::NIGHTLY, combine(PermuteParametersLarge, framework::dataset::make("DataType", DataType::U32)))
+FIXTURE_DATA_TEST_CASE(RunLarge, NEPermuteFixture<uint32_t>, framework::DatasetMode::NIGHTLY,
+ PermuteParametersLarge * framework::dataset::make("DataType", DataType::U32))
{
// Validate output
validate(Accessor(_target), _reference);
diff --git a/tests/validation/fixtures/PermuteFixture.h b/tests/validation/fixtures/PermuteFixture.h
index 3aae384706..92d01a5654 100644
--- a/tests/validation/fixtures/PermuteFixture.h
+++ b/tests/validation/fixtures/PermuteFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -46,10 +46,10 @@ class PermuteValidationFixture : public framework::Fixture
{
public:
template <typename...>
- void setup(TensorShape shape, PermutationVector perm, DataType data_type)
+ void setup(TensorShape input_shape, DataLayout input_layout, PermutationVector perm, DataType data_type)
{
- _target = compute_target(shape, data_type, perm);
- _reference = compute_reference(shape, data_type, perm);
+ _target = compute_target(input_shape, input_layout, data_type, perm);
+ _reference = compute_reference(input_shape, data_type, perm);
}
protected:
@@ -59,14 +59,14 @@ protected:
library->fill_tensor_uniform(tensor, 0);
}
- TensorType compute_target(const TensorShape &shape, DataType data_type, PermutationVector perm)
+ TensorType compute_target(const TensorShape &input_shape, DataLayout input_layout, DataType data_type, PermutationVector perm)
{
// Permute shapes
- TensorShape output_shape = shape;
+ TensorShape output_shape = input_shape;
permute(output_shape, perm);
// Create tensors
- TensorType src = create_tensor<TensorType>(shape, data_type);
+ TensorType src = create_tensor<TensorType>(input_shape, data_type);
TensorType dst = create_tensor<TensorType>(output_shape, data_type);
// Create and configure function
@@ -92,10 +92,10 @@ protected:
return dst;
}
- SimpleTensor<T> compute_reference(const TensorShape &shape, DataType data_type, PermutationVector perm)
+ SimpleTensor<T> compute_reference(const TensorShape &input_shape, DataType data_type, PermutationVector perm)
{
// Create reference
- SimpleTensor<T> src{ shape, data_type };
+ SimpleTensor<T> src{ input_shape, data_type };
// Fill reference
fill(src);