aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Haddon <matthew.haddon@arm.com>2021-07-27 16:31:16 +0100
committerMatthew Haddon <matthew.haddon@arm.com>2021-07-27 16:31:16 +0100
commita44ac5ef26bbe3c6f2a761cd9bed9ca4fb67a131 (patch)
treecebacc1c5a355c0e518afbc13dd3cd255606a3cc
parentf54d8a2d341e1ebc5f37465a2e1b08d7e9c9785c (diff)
downloadreference_model-a44ac5ef26bbe3c6f2a761cd9bed9ca4fb67a131.tar.gz
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 <matthew.haddon@arm.com> Change-Id: Ief78cff8bd42bd24e9b977d41d05c1504d0422b4
-rw-r--r--verif/tosa_test_gen.py14
1 files 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