aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/CPP/Utils.h
diff options
context:
space:
mode:
authorIsabella Gottardi <isabella.gottardi@arm.com>2017-08-29 13:47:03 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit83be745adba7a9928c03beda65a6a83f14846475 (patch)
tree3a95d8ec8dc853256e469dadba4dd57360db57d7 /tests/validation/CPP/Utils.h
parentab60fe8cd25232fdefef95b86e18482343f9d05f (diff)
downloadComputeLibrary-83be745adba7a9928c03beda65a6a83f14846475.tar.gz
COMPMID-424 Implemented reference implementation and tests for WarpAffine
Change-Id: I4924ab1de17adc3b880a5cc22f2497abbc8e221b Reviewed-on: http://mpd-gerrit.cambridge.arm.com/85820 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Steven Niu <steven.niu@arm.com>
Diffstat (limited to 'tests/validation/CPP/Utils.h')
-rw-r--r--tests/validation/CPP/Utils.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/validation/CPP/Utils.h b/tests/validation/CPP/Utils.h
index 91d1afe1d7..e9a0f09847 100644
--- a/tests/validation/CPP/Utils.h
+++ b/tests/validation/CPP/Utils.h
@@ -100,6 +100,32 @@ void apply_2d_spatial_filter(Coordinates coord, const SimpleTensor<T> &src, Simp
}
RawTensor transpose(const RawTensor &src, int chunk_width = 1);
+
+/** Fill matrix random.
+ *
+ * @param[in,out] matrix Matrix
+ * @param[in] cols Columns (width) of matrix
+ * @param[in] rows Rows (height) of matrix
+ */
+template <std::size_t SIZE>
+inline void fill_warp_matrix(std::array<float, SIZE> &matrix, int cols, int rows)
+{
+ std::mt19937 gen(library.get()->seed());
+ std::uniform_real_distribution<float> dist(-1, 1);
+
+ for(int v = 0, r = 0; r < rows; ++r)
+ {
+ for(int c = 0; c < cols; ++c, ++v)
+ {
+ matrix[v] = dist(gen);
+ }
+ }
+ if(SIZE == 9)
+ {
+ matrix[(cols * rows) - 1] = 1;
+ }
+}
+
} // namespace validation
} // namespace test
} // namespace arm_compute