From 8c06a6547a132f0a22fa34d467026f12fabb4e1f Mon Sep 17 00:00:00 2001 From: Jeremy Johnson Date: Wed, 20 Oct 2021 15:51:11 +0100 Subject: Limit tensor values for COND_IF/WHILE_LOOP tests to stop saturation Change-Id: Idb36b1f1c0d78ec101c168865a9c8d03221b4c84 Signed-off-by: Jeremy Johnson --- verif/tosa_test_gen.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/verif/tosa_test_gen.py b/verif/tosa_test_gen.py index 04fce90..105f016 100644 --- a/verif/tosa_test_gen.py +++ b/verif/tosa_test_gen.py @@ -4030,6 +4030,20 @@ class TosaTestGen: self.ser.addPlaceholder(shapeList[1], dtypeList[1], b_unsat_arr) ) + tens.extend(placeholders) + elif (op["op"] == Op.COND_IF or op["op"] == Op.WHILE_LOOP) and dtypeList[0] == DType.INT32: + # Limit input tensors with cond_if_binary or while_loop to stop + # saturation of add/sub ops + pRemain = pCount + placeholders = [] + for idx, shape in enumerate(shapeList[:]): + arr = self.getRandTensor(shapeList[idx], DType.INT16) + if pRemain > 0: + placeholders.append(self.ser.addPlaceholder(shape, dtypeList[idx], arr)) + pRemain -= 1 + else: + placeholders.append(self.ser.addConst(shape, dtypeList[idx], arr)) + tens.extend(placeholders) elif op["op"] == Op.ARITHMETIC_RIGHT_SHIFT: # Force value of operand[1] to be within [0, num_bits] -- cgit v1.2.1