From 68e7aee65bda5ac03fa7def753b7dc7462554793 Mon Sep 17 00:00:00 2001 From: Matthew Haddon Date: Mon, 16 Aug 2021 11:20:25 +0100 Subject: Make MATMUL output shape random * Currently when a target shape is specified, the W value of the input tensor is always equal to N, this is not the case when no target shape is defined. * A random value for W is generated every time. Signed-off-by: Matthew Haddon Change-Id: I8f8ecb32308cef4a1ece1871f76ebbd5f0cf881f --- verif/tosa_test_gen.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/verif/tosa_test_gen.py b/verif/tosa_test_gen.py index 5138e3f..a3c6b05 100644 --- a/verif/tosa_test_gen.py +++ b/verif/tosa_test_gen.py @@ -325,9 +325,19 @@ class TosaTensorGen: assert pl == 2 and const == 0 a_shape = testGen.makeShape(rank) - b_oc = testGen.makeShape(1)[0] - b_shape = np.asarray([a_shape[0], a_shape[2], b_oc]) + # Get a random number for b_oc even if target shape is defined + b_oc = np.int32( + testGen.rng.integers( + low=testGen.args.tensor_shape_range[0], + high=testGen.args.tensor_shape_range[1], + size=1, + ) + )[0] + # If N or H is large let b_oc be 1 to reduce output tensor size + if max(a_shape) > 1000: + b_oc = 1 + b_shape = np.asarray([a_shape[0], a_shape[2], b_oc]) return [a_shape, b_shape] @staticmethod -- cgit v1.2.1