From 17009399160defd4ab21d85249ff31804d732f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Alfv=C3=A9n?= Date: Tue, 30 Aug 2022 09:14:56 +0200 Subject: 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 Change-Id: I734465730372105821a5e2f73a6a125b9eb7d7f4 --- ethosu/vela/test/test_tflite_supported_operators.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'ethosu/vela/test') 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}) -- cgit v1.2.1