aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLes Bell <les.bell@arm.com>2021-07-28 15:37:02 +0100
committerEric Kunze <eric.kunze@arm.com>2021-08-12 16:01:10 +0000
commit7ffccce9b9a7eeecbad0c0525f1545c2714f8556 (patch)
treeaf9d7a93f9551e87463db252dde99859c6e37478
parentcac4ee9575a9bae4f6502f8ba7f86e294b92edff (diff)
downloadreference_model-7ffccce9b9a7eeecbad0c0525f1545c2714f8556.tar.gz
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 <les.bell@arm.com>
-rw-r--r--verif/tosa_test_gen.py31
1 files 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