aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Tello <pablo.tello@arm.com>2017-09-27 10:07:45 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commitd616cb906e6fb7eda3d1527c0ac3d630fc1c71c7 (patch)
tree13eca21fcf5b6ee2bdb2703549f1d258fbd9eae5
parentdaec1aa17a27b5b10ae9bcda66cc51d708da4da9 (diff)
downloadComputeLibrary-d616cb906e6fb7eda3d1527c0ac3d630fc1c71c7.tar.gz
COMPMID-510: Cleaned up Warp tests.
Change-Id: I8e3fece5b786b5529e8f1320fb5794e43756ec4a Reviewed-on: http://mpd-gerrit.cambridge.arm.com/89274 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
-rw-r--r--tests/validation/CL/WarpAffine.cpp2
-rw-r--r--tests/validation/CL/WarpPerspective.cpp2
-rw-r--r--tests/validation/CPP/Utils.h13
-rw-r--r--tests/validation/NEON/WarpAffine.cpp2
-rw-r--r--tests/validation/NEON/WarpPerspective.cpp2
-rw-r--r--tests/validation/fixtures/WarpAffineFixture.h4
-rw-r--r--tests/validation/fixtures/WarpPerspectiveFixture.h2
7 files changed, 12 insertions, 15 deletions
diff --git a/tests/validation/CL/WarpAffine.cpp b/tests/validation/CL/WarpAffine.cpp
index 9177fcb5a7..9db2ccaacc 100644
--- a/tests/validation/CL/WarpAffine.cpp
+++ b/tests/validation/CL/WarpAffine.cpp
@@ -66,7 +66,7 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combi
// Create the matrix
std::array<float, 6> matrix{ {} };
- fill_warp_matrix<6>(matrix, 3, 2);
+ fill_warp_matrix<6>(matrix);
// Create tensors
CLTensor src = create_tensor<CLTensor>(shape, data_type);
diff --git a/tests/validation/CL/WarpPerspective.cpp b/tests/validation/CL/WarpPerspective.cpp
index 011fe905da..2edf9119d6 100644
--- a/tests/validation/CL/WarpPerspective.cpp
+++ b/tests/validation/CL/WarpPerspective.cpp
@@ -67,7 +67,7 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combi
// Create the matrix
std::array<float, 9> matrix = { { 0 } };
- fill_warp_matrix<9>(matrix, 3, 3);
+ fill_warp_matrix<9>(matrix);
// Create tensors
CLTensor src = create_tensor<CLTensor>(shape, data_type);
diff --git a/tests/validation/CPP/Utils.h b/tests/validation/CPP/Utils.h
index 38fd924afc..0733411462 100644
--- a/tests/validation/CPP/Utils.h
+++ b/tests/validation/CPP/Utils.h
@@ -106,21 +106,18 @@ RawTensor transpose(const RawTensor &src, int chunk_width = 1);
* @param[in,out] matrix Matrix
*/
template <std::size_t SIZE>
-inline void fill_warp_matrix(std::array<float, SIZE> &matrix, int cols, int rows)
+inline void fill_warp_matrix(std::array<float, SIZE> &matrix)
{
std::mt19937 gen(library.get()->seed());
std::uniform_real_distribution<float> dist(-1, 1);
-
- for(int v = 0, r = 0; r < rows; ++r)
+ for(auto &x : matrix)
{
- for(int c = 0; c < cols; ++c, ++v)
- {
- matrix[v] = dist(gen);
- }
+ x = dist(gen);
}
if(SIZE == 9)
{
- matrix[(cols * rows) - 1] = 1;
+ // This is only used in Warp Perspective, we set M[3][3] = 1 so that Z0 is not 0 and we avoid division by 0.
+ matrix[8] = 1.f;
}
}
diff --git a/tests/validation/NEON/WarpAffine.cpp b/tests/validation/NEON/WarpAffine.cpp
index 1b52f9f07c..2460f1a510 100644
--- a/tests/validation/NEON/WarpAffine.cpp
+++ b/tests/validation/NEON/WarpAffine.cpp
@@ -65,7 +65,7 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combi
// Create the matrix
std::array<float, 6> matrix{ {} };
- fill_warp_matrix<6>(matrix, 3, 2);
+ fill_warp_matrix<6>(matrix);
// Create tensors
Tensor src = create_tensor<Tensor>(shape, data_type);
diff --git a/tests/validation/NEON/WarpPerspective.cpp b/tests/validation/NEON/WarpPerspective.cpp
index 9c1358bb15..45d3a0b878 100644
--- a/tests/validation/NEON/WarpPerspective.cpp
+++ b/tests/validation/NEON/WarpPerspective.cpp
@@ -67,7 +67,7 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combi
// Create the matrix
std::array<float, 9> matrix = { { 0 } };
- fill_warp_matrix<9>(matrix, 3, 3);
+ fill_warp_matrix<9>(matrix);
// Create tensors
Tensor src = create_tensor<Tensor>(shape, data_type);
diff --git a/tests/validation/fixtures/WarpAffineFixture.h b/tests/validation/fixtures/WarpAffineFixture.h
index 3b106e15d6..fef1f6b626 100644
--- a/tests/validation/fixtures/WarpAffineFixture.h
+++ b/tests/validation/fixtures/WarpAffineFixture.h
@@ -56,7 +56,7 @@ public:
// Create the matrix
std::array<float, 6> matrix{ {} };
- fill_warp_matrix<6>(matrix, 3, 2);
+ fill_warp_matrix<6>(matrix);
_target = compute_target(shape, data_type, matrix.data(), policy, border_mode, constant_border_value);
_reference = compute_reference(shape, data_type, matrix.data(), policy, border_mode, constant_border_value);
@@ -118,4 +118,4 @@ protected:
} // namespace validation
} // namespace test
} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_WARP_AFFINE_FIXTURE */ \ No newline at end of file
+#endif /* ARM_COMPUTE_TEST_WARP_AFFINE_FIXTURE */
diff --git a/tests/validation/fixtures/WarpPerspectiveFixture.h b/tests/validation/fixtures/WarpPerspectiveFixture.h
index a99ee4e55b..c77efbdc0d 100644
--- a/tests/validation/fixtures/WarpPerspectiveFixture.h
+++ b/tests/validation/fixtures/WarpPerspectiveFixture.h
@@ -62,7 +62,7 @@ public:
// Create the matrix
std::array<float, 9> matrix = { { 0 } };
- fill_warp_matrix<9>(matrix, 3, 3);
+ fill_warp_matrix<9>(matrix);
_target = compute_target(input_shape, vmask_shape, matrix.data(), policy, border_mode, constant_border_value, data_type);
_reference = compute_reference(input_shape, vmask_shape, matrix.data(), policy, border_mode, constant_border_value, data_type);