aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/CPP/Utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/validation/CPP/Utils.h')
-rw-r--r--tests/validation/CPP/Utils.h13
1 files changed, 5 insertions, 8 deletions
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;
}
}