aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/test
diff options
context:
space:
mode:
authorLouis Verhaard <louis.verhaard@arm.com>2021-02-03 10:22:38 +0100
committerLouis Verhaard <louis.verhaard@arm.com>2021-02-03 13:22:56 +0100
commitc77615121c28409081d2ac6526694edebb8d7255 (patch)
tree15f234c73d7d0cb45b7d69c2576fc0cb04a46475 /ethosu/vela/test
parent66d7ec060a9c97f2095cb65f7242fa044a505810 (diff)
downloadethos-u-vela-c77615121c28409081d2ac6526694edebb8d7255.tar.gz
MLBEDSW-3572: Fused activations must not be int32
Added supported operator check that 32-bit fused activation functions are not supported. Change-Id: I01fdafeff8fdb13c71eae4f63be7e6f81b9223df Signed-off-by: Louis Verhaard <louis.verhaard@arm.com>
Diffstat (limited to 'ethosu/vela/test')
-rw-r--r--ethosu/vela/test/test_supported_operators.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/ethosu/vela/test/test_supported_operators.py b/ethosu/vela/test/test_supported_operators.py
index 5f64dd9d..3e9724d3 100644
--- a/ethosu/vela/test/test_supported_operators.py
+++ b/ethosu/vela/test/test_supported_operators.py
@@ -147,6 +147,16 @@ def test_constraint_faf():
assert not support.is_operator_supported(op)
+def test_constraint_faf_ofm_dtype():
+ # If fused activation function is present, OFM must be 8 or 16 bit
+ shp = [1, 8, 8, 8]
+ for dtype in [DataType.int8, DataType.uint8, DataType.int16, DataType.int32]:
+ op = testutil.create_elemwise_op(Op.Add, "op", shp, shp, shp, datatype=dtype)
+ op.activation = ActivationFunction(Op.Relu)
+ expected = dtype.size_in_bytes() <= 2
+ assert support.is_operator_supported(op) == expected, f"Data type: {dtype}"
+
+
def test_constraint_conv_pass():
# First test a simple conv passes
op = testutil.create_op_with_quant_tensors(Op.Conv2D, [1, 1, 1, 1], [1, 1, 1, 1], weights_shape=[1, 1, 1, 1])