diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2019-12-03 15:11:09 +0000 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2019-12-04 11:15:51 +0000 |
commit | bc4d7c2d0c3484152256d5c9dbb61e6a149bdc20 (patch) | |
tree | 902210cf313111112b43f35c290e5a4def599001 /tests/validation/reference/ArithmeticOperations.cpp | |
parent | 1f332d4a41393ed30a4e9df841eb4b545fa87486 (diff) | |
download | ComputeLibrary-bc4d7c2d0c3484152256d5c9dbb61e6a149bdc20.tar.gz |
COMPMID-2797 Add support for QASYMM8_SIGNED in NEArithmeticAddition
Change-Id: Ie1abf7839d40ffcdc9748c5a3baee7c00cabad21
Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com>
Reviewed-on: https://review.mlplatform.org/c/2413
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/reference/ArithmeticOperations.cpp')
-rw-r--r-- | tests/validation/reference/ArithmeticOperations.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/validation/reference/ArithmeticOperations.cpp b/tests/validation/reference/ArithmeticOperations.cpp index 0ec328ee6a..a2be9c9d11 100644 --- a/tests/validation/reference/ArithmeticOperations.cpp +++ b/tests/validation/reference/ArithmeticOperations.cpp @@ -125,6 +125,33 @@ SimpleTensor<uint8_t> arithmetic_operation(ArithmeticOperation op, const SimpleT } template <> +SimpleTensor<int8_t> arithmetic_operation(ArithmeticOperation op, const SimpleTensor<int8_t> &src1, const SimpleTensor<int8_t> &src2, SimpleTensor<int8_t> &dst, ConvertPolicy convert_policy) +{ + Coordinates id_src1{}; + Coordinates id_src2{}; + Coordinates id_dst{}; + + if(dst.data_type() == DataType::QASYMM8_SIGNED) + { + SimpleTensor<float> src1_tmp = convert_from_asymmetric(src1); + SimpleTensor<float> src2_tmp = convert_from_asymmetric(src2); + SimpleTensor<float> dst_tmp(TensorShape::broadcast_shape(src1.shape(), src2.shape()), dst.data_type()); + + BroadcastUnroll<Coordinates::num_max_dimensions>::unroll(op, src1_tmp, src2_tmp, dst_tmp, convert_policy, id_src1, id_src2, id_dst); + + dst = convert_to_asymmetric<int8_t>(dst_tmp, dst.quantization_info()); + return dst; + } + else + { + // DataType::S8 + BroadcastUnroll<Coordinates::num_max_dimensions>::unroll(op, src1, src2, dst, convert_policy, id_src1, id_src2, id_dst); + + return dst; + } +} + +template <> SimpleTensor<int16_t> arithmetic_operation(ArithmeticOperation op, const SimpleTensor<int16_t> &src1, const SimpleTensor<int16_t> &src2, SimpleTensor<int16_t> &dst, ConvertPolicy convert_policy) { Coordinates id_src1{}; |