From 75eaa25020af22331a194a59d30cd390f85678fe Mon Sep 17 00:00:00 2001 From: Yaman Umuroglu <yamanu@xilinx.com> Date: Fri, 22 Nov 2019 13:35:37 +0000 Subject: [PATCH] [Test] add test_interleave_matrix_outer_dim_from_partitions --- tests/test_shape_utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/test_shape_utils.py diff --git a/tests/test_shape_utils.py b/tests/test_shape_utils.py new file mode 100644 index 000000000..09e14bb05 --- /dev/null +++ b/tests/test_shape_utils.py @@ -0,0 +1,13 @@ +import numpy as np + +import finn.core.utils as util + + +def test_interleave_matrix_outer_dim_from_partitions(): + A = np.eye(10) + n_parts = 2 + Ax = util.interleave_matrix_outer_dim_from_partitions(A, n_parts) + part_size = 10 // n_parts + assert Ax.shape == (n_parts, part_size, 10) + for r_ind in range(A.shape[0]): + assert (A[r_ind] == Ax[r_ind % n_parts][r_ind // n_parts]).all() -- GitLab