diff options
author | Matthew Haddon <matthew.haddon@arm.com> | 2021-08-16 11:20:25 +0100 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2021-08-20 15:47:56 +0000 |
commit | 68e7aee65bda5ac03fa7def753b7dc7462554793 (patch) | |
tree | 85b0f21e6e4ce66b20e70055e8381cefa5afb9e3 | |
parent | 818ab900ed8e64f43aeebff9924ad883fc349e64 (diff) | |
download | reference_model-68e7aee65bda5ac03fa7def753b7dc7462554793.tar.gz |
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 <matthew.haddon@arm.com>
Change-Id: I8f8ecb32308cef4a1ece1871f76ebbd5f0cf881f
-rw-r--r-- | verif/tosa_test_gen.py | 14 |
1 files 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 |