aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/test/test_tflite_model_semantic.py
diff options
context:
space:
mode:
authorJohan Alfvén <johan.alfven@arm.com>2022-05-11 13:10:50 +0200
committerJohan Alfvén <johan.alfven@arm.com>2022-05-11 15:38:49 +0200
commite51a05c4ab4493a6745dd15d6d6a41d0f1663552 (patch)
treeda24eaf94f277365de03363784c64667a23e97a4 /ethosu/vela/test/test_tflite_model_semantic.py
parentf018a6831e9b3267436b9e352f08d7b64df628b8 (diff)
downloadethos-u-vela-e51a05c4ab4493a6745dd15d6d6a41d0f1663552.tar.gz
MLBEDSW-6454: Enable ReLu with negative alpha value
Removing constraint for negative alpha value in ReLu for int8 and uint8. Signed-off-by: Johan Alfven <johan.alfven@arm.com> Change-Id: Id7a3a30bf5d1f0a591f990bd04cd0dbbad5819c6
Diffstat (limited to 'ethosu/vela/test/test_tflite_model_semantic.py')
-rw-r--r--ethosu/vela/test/test_tflite_model_semantic.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/ethosu/vela/test/test_tflite_model_semantic.py b/ethosu/vela/test/test_tflite_model_semantic.py
index 2d6ca15a..e290dd2c 100644
--- a/ethosu/vela/test/test_tflite_model_semantic.py
+++ b/ethosu/vela/test/test_tflite_model_semantic.py
@@ -413,12 +413,17 @@ def test_constraint_matching_either_shapes():
def test_constraint_alpha_valid():
- # Alpha cannot be negative
- op = testutil.create_elemwise_op(Op.LeakyRelu, "op", [2, 2], None, [2, 2])
+ # Alpha can only be negative for int8 and uint8
+ op = testutil.create_elemwise_op(Op.LeakyRelu, "op", [2, 2], None, [2, 2], DataType.int16)
op.attrs["alpha"] = 0
assert semantic_checker.is_operator_semantic_valid(op)
op.attrs["alpha"] = -1
assert not semantic_checker.is_operator_semantic_valid(op)
+ op = testutil.create_elemwise_op(Op.LeakyRelu, "op", [2, 2], None, [2, 2], DataType.int8)
+ op.attrs["alpha"] = 0
+ assert semantic_checker.is_operator_semantic_valid(op)
+ op.attrs["alpha"] = -1
+ assert semantic_checker.is_operator_semantic_valid(op)
def test_constraint_hardswish_dtype():