diff options
author | Viet-Hoa Do <viet-hoa.do@arm.com> | 2022-08-10 11:56:49 +0100 |
---|---|---|
committer | Viet-Hoa Do <viet-hoa.do@arm.com> | 2022-08-17 11:35:03 +0000 |
commit | 29db3d293302254b80e82651895d997ca145142a (patch) | |
tree | 606d1193e7f92623e0af97aea513106ec468bff0 /arm_compute/core/QuantizationInfo.h | |
parent | e54d8c07e75d70baeb80fecbb43088027ea45658 (diff) | |
download | ComputeLibrary-29db3d293302254b80e82651895d997ca145142a.tar.gz |
Add LUT for quantized sigmoid function
* Move LUT implementation to a seperate file. It will be used
for both QASYMM8 and QASYMM8_SIGNED.
* Fix wrong constant value related to QASYMM8_SIGNED leaky ReLU
in 32-bit build.
Resolves: COMPMID-5464
Signed-off-by: Viet-Hoa Do <viet-hoa.do@arm.com>
Change-Id: I2b24d52409a38f1b66fd532f431eff8a9e4547b6
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8066
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gunes Bayir <gunes.bayir@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/QuantizationInfo.h')
-rw-r--r-- | arm_compute/core/QuantizationInfo.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arm_compute/core/QuantizationInfo.h b/arm_compute/core/QuantizationInfo.h index 21d962d08b..ed1025edc0 100644 --- a/arm_compute/core/QuantizationInfo.h +++ b/arm_compute/core/QuantizationInfo.h @@ -420,6 +420,26 @@ inline qasymm8_t qasymm8_leaky_relu(qasymm8_t in, return tmp; } +inline qasymm8_t qasymm8_logistic(qasymm8_t in, + const UniformQuantizationInfo &qi_in, + const UniformQuantizationInfo &qi_out) +{ + float tmp_f = dequantize_qasymm8(in, qi_in); + tmp_f = 1.f / (1.f + std::exp(-tmp_f)); + const qasymm8_t tmp = quantize_qasymm8(tmp_f, qi_out); + return tmp; +} + +inline qasymm8_signed_t qasymm8_signed_logistic(qasymm8_signed_t in, + const UniformQuantizationInfo &qi_in, + const UniformQuantizationInfo &qi_out) +{ + float tmp_f = dequantize_qasymm8_signed(in, qi_in); + tmp_f = 1.f / (1.f + std::exp(-tmp_f)); + const qasymm8_signed_t tmp = quantize_qasymm8_signed(tmp_f, qi_out); + return tmp; +} + /** Dequantize a value given a 8-bit symmetric quantization scheme * * @param[in] value Value to dequantize |