aboutsummaryrefslogtreecommitdiff
path: root/verif/generator/tosa_utils.py
diff options
context:
space:
mode:
authorLuke Hutton <luke.hutton@arm.com>2023-02-22 11:53:48 +0000
committerEric Kunze <eric.kunze@arm.com>2023-02-28 20:08:57 +0000
commita4e48ca7b032992ca0110900935c08d7cf860cd3 (patch)
treea58c8617390225ecc107721d9b5ff87c2bdb01b0 /verif/generator/tosa_utils.py
parent2226f90d5a6c48a975045bc9e0419113ce764aaf (diff)
downloadreference_model-a4e48ca7b032992ca0110900935c08d7cf860cd3.tar.gz
Update rank limits for SLICE, TILE and TRANSPOSE
Updated to align with corresponding changes to the spec. In addition, some ERROR_IF tests have been updated to match the checks specified by the spec, including: PAD, SLICE, TILE, TRANSPOSE. Signed-off-by: Luke Hutton <luke.hutton@arm.com> Change-Id: Ie2c5f48e79a5610eb82739170e25057a63dac1d8
Diffstat (limited to 'verif/generator/tosa_utils.py')
-rw-r--r--verif/generator/tosa_utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/verif/generator/tosa_utils.py b/verif/generator/tosa_utils.py
index 29ae898..8ff62f1 100644
--- a/verif/generator/tosa_utils.py
+++ b/verif/generator/tosa_utils.py
@@ -148,6 +148,17 @@ def get_wrong_output_type(op_name, rng, input_dtype):
return rng.choice(a=incorrect_types)
+def get_rank_mismatch_shape(rng, output_shape):
+ """
+ Extends the rank of the provided output_shape by
+ an arbitrary amount but ensures the total element
+ count remains the same.
+ """
+ rank_modifier = rng.choice([1, 2, 3])
+ output_shape += [1] * rank_modifier
+ return output_shape
+
+
def float32_is_valid_bfloat16(f):
"""Return True if float value is valid bfloat16."""
f32_bits = get_float32_bitstring(f)