aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/test
diff options
context:
space:
mode:
authorJohan Alfvén <johan.alfven@arm.com>2022-08-30 09:14:56 +0200
committerFredrik Svedberg <fredrik.svedberg@arm.com>2022-09-01 11:33:50 +0000
commit17009399160defd4ab21d85249ff31804d732f4b (patch)
tree048ddcaf079437a583b7bab6d05e629419b67f04 /ethosu/vela/test
parent89a8cdd5425521f68674ac23a78790f0f6dc98ed (diff)
downloadethos-u-vela-17009399160defd4ab21d85249ff31804d732f4b.tar.gz
MLBEDSW-5029: Output diff for Mean op
Fixed three test cases causing output diff compared to the reference kernel for the Mean operator. - If there is a possibility that the accumulator could saturate the Mean op must run CPU - Use correct rounding for the bias term - If a Reshape op is followed by a Mean op, push the Reshape op to the CPU since this cannot be handled by the NPU Signed-off-by: Johan Alfven <johan.alfven@arm.com> Change-Id: I734465730372105821a5e2f73a6a125b9eb7d7f4
Diffstat (limited to 'ethosu/vela/test')
-rw-r--r--ethosu/vela/test/test_tflite_supported_operators.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/ethosu/vela/test/test_tflite_supported_operators.py b/ethosu/vela/test/test_tflite_supported_operators.py
index 89c27997..cc8b3d2c 100644
--- a/ethosu/vela/test/test_tflite_supported_operators.py
+++ b/ethosu/vela/test/test_tflite_supported_operators.py
@@ -623,6 +623,22 @@ def test_mean_hw_product_int8():
op = create_mean([1, 16, 17, 16], [1, 1, 1, 16], [1, 2], DataType.int8, {"keep_dims": True})
assert not support.is_operator_supported(op)
+ # Create OP that will not saturate the accumulator
+ op = create_mean([1, 5, 14, 16], [1, 1, 1, 16], [1, 2], DataType.int8, {"keep_dims": True})
+ op.ifm.quantization.scale_f32 = 2.0
+ op.ifm.quantization.zero_point = 95
+ op.ofm.quantization.scale_f32 = 1.0
+ op.ofm.quantization.zero_point = 95
+ assert support.is_operator_supported(op)
+
+ # Create OP that can saturate the accumulator
+ op = create_mean([1, 6, 14, 16], [1, 1, 1, 16], [1, 2], DataType.int8, {"keep_dims": True})
+ op.ifm.quantization.scale_f32 = 2.0
+ op.ifm.quantization.zero_point = 95
+ op.ofm.quantization.scale_f32 = 1.0
+ op.ofm.quantization.zero_point = 95
+ assert not support.is_operator_supported(op)
+
def test_mean_hw_product_avgpool():
op = create_mean([1, 200, 200, 16], [1, 16], [1, 2], DataType.uint8, {"keep_dims": False})