From a44ac5ef26bbe3c6f2a761cd9bed9ca4fb67a131 Mon Sep 17 00:00:00 2001 From: Matthew Haddon Date: Tue, 27 Jul 2021 16:31:16 +0100 Subject: Fix bug causing test generator to create unused input tensor * The SELECT operator requires a boolean condition tensor, this is now enforced earlier in the code to avoid an unused input tensor being created. Signed-off-by: Matthew Haddon Change-Id: Ief78cff8bd42bd24e9b977d41d05c1504d0422b4 --- verif/tosa_test_gen.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/verif/tosa_test_gen.py b/verif/tosa_test_gen.py index 4820503..ba31c2d 100644 --- a/verif/tosa_test_gen.py +++ b/verif/tosa_test_gen.py @@ -1106,15 +1106,8 @@ class TosaTestGen: return result_tens def build_select(self, op, cond, a, b): - - # Replace the cond tensor with a boolean tensor since it probably - # has the wrong dtype - t = self.buildPlaceholderTensors([cond.shape], [DType.BOOL]) - cond = t[0] - result_tens = OutputShaper.selectOp(self.ser, cond, a, b) self.ser.addOperator(op, [cond.name, a.name, b.name], [result_tens.name]) - return result_tens def build_comparison(self, op, a, b): @@ -1743,6 +1736,13 @@ class TosaTestGen: placeholders.append(self.ser.addPlaceholder(shape, dtypeList[idx], arr)) tens.extend(placeholders) + elif op["op"] == Op.SELECT: + # Set datatype of condition tensor to boolean + dtypeList[0] = DType.BOOL + tens.extend( + self.buildPlaceholderTensors(shapeList[0:pCount], dtypeList[0:pCount]) + ) + tens.extend(self.buildConstTensors(shapeList[pCount:], dtypeList[pCount:])) elif op["op"] == Op.DIV: assert ( pCount == 2 and cCount == 0 -- cgit v1.2.1