From 7ffccce9b9a7eeecbad0c0525f1545c2714f8556 Mon Sep 17 00:00:00 2001 From: Les Bell Date: Wed, 28 Jul 2021 15:37:02 +0100 Subject: test gen PAD agPad fix to cover all pad values * encode pad in the test name with leading zeros Change-Id: I7b1cc04014d390e707de099c5f78f93f5f344d69 Signed-off-by: Les Bell --- verif/tosa_test_gen.py | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/verif/tosa_test_gen.py b/verif/tosa_test_gen.py index c05abc0..e375a2a 100644 --- a/verif/tosa_test_gen.py +++ b/verif/tosa_test_gen.py @@ -466,23 +466,20 @@ class TosaArgGen: arg_list = [] rank = len(shapeList[0]) - # Exhaustively test combinations of 0/1 padding on each side of each dimension - # This process might need some revision for >1 padding, but use rank**2 as a bitmask - # for now - for v in range(rank ** 2): - - # Create a flat arraypadding4D - paddings = np.zeros((rank * 2), dtype=np.int32) - - # Fill in the 1's - for r in range(rank * 2): - if (v >> r) & 1: - paddings[r] = 1 - - # Reshape back to a 2D array - paddings = paddings.reshape((rank, 2)) - - arg_list.append(("pad{0:b}".format(v), [paddings])) + # Exhaustively test combinations of padding on each side of each dimension + # - the range of padding values is defined by pad_min and pad_max + # - for padding >9, the name format needs to be more distinctive + pad_min, pad_max = 0, 1 + pad_values = [x for x in range(pad_min, pad_max + 1)] + axis_pad_values = [x for x in itertools.product(pad_values, pad_values)] + shape_pad_values = itertools.product(*([axis_pad_values] * rank)) + + for paddings in shape_pad_values: + name = "pad" + for r in range(rank): + before, after = paddings[r] + name = f"{name}{before}{after}" + arg_list.append((name, [np.array(paddings)])) return arg_list -- cgit v1.2.1