From e570cb65812042d5d70da4789d7fa0247459e82a Mon Sep 17 00:00:00 2001 From: Yaman Umuroglu <yamanu@xilinx.com> Date: Thu, 2 Jun 2022 12:29:59 +0200 Subject: [PATCH] [Test] bugfixes in test_runtime_thresholds_single_layer --- tests/fpgadataflow/test_fpgadataflow_thresholding.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/fpgadataflow/test_fpgadataflow_thresholding.py b/tests/fpgadataflow/test_fpgadataflow_thresholding.py index 4cfdbe82d..7d95cba11 100644 --- a/tests/fpgadataflow/test_fpgadataflow_thresholding.py +++ b/tests/fpgadataflow/test_fpgadataflow_thresholding.py @@ -245,7 +245,7 @@ def test_runtime_thresholds_single_layer(): # add two copies of the input tensor as the first one is just used to # "flush out" the pipeline (as mvau already starts receiving old weights while # we read/write new ones and reads seem to cause a disturbance too) - in_tensor = np.tile(in_tensor, (2, 1)) + in_tensor = np.tile(in_tensor, (2, 1, 1, 1)) exec_ctx = {"inp": in_tensor} extracted_weight_stream = [] @@ -297,7 +297,10 @@ def test_runtime_thresholds_single_layer(): rtlsim_exec(model, exec_ctx, pre_hook=write_weights) y = exec_ctx["outp"][1] - expected = multithreshold(in_tensor, new_weights)[1] + # multithreshold util fxn wants NCHW input, not NHWC + expected = multithreshold(np.transpose(in_tensor, (0, 3, 1, 2)), new_weights) + # convert back to NHWC for comparison to hw outputs + expected = np.transpose(expected, (0, 2, 3, 1))[1] if act == DataType["BIPOLAR"]: # binary to bipolar expected = 2 * expected - 1 -- GitLab