aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/QuantizationInfo.h
diff options
context:
space:
mode:
authorPablo Marquez Tello <pablo.tello@arm.com>2022-07-25 14:41:26 +0100
committerPablo Marquez Tello <pablo.tello@arm.com>2022-09-01 13:20:07 +0000
commit16789a14afc27c1a77c8ca1e3d04b79cda6c833b (patch)
tree3404d904b82d2031fc1ad4eb90a02c89ea690f7d /arm_compute/core/QuantizationInfo.h
parentcd083cf70fed41858407d1f7e082f760a2dbe87a (diff)
downloadComputeLibrary-16789a14afc27c1a77c8ca1e3d04b79cda6c833b.tar.gz
Compute Hard-Swish with a Lookup table for qasymm8_signed.
* Resolves COMPMID-5211 Change-Id: I7cc72662bb1cf52bf112685639d3dbba33d1333f Signed-off-by: Pablo Marquez Tello <pablo.tello@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/7993 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Gunes Bayir <gunes.bayir@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/QuantizationInfo.h')
-rw-r--r--arm_compute/core/QuantizationInfo.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/arm_compute/core/QuantizationInfo.h b/arm_compute/core/QuantizationInfo.h
index ed1025edc0..ddf1342e32 100644
--- a/arm_compute/core/QuantizationInfo.h
+++ b/arm_compute/core/QuantizationInfo.h
@@ -409,6 +409,16 @@ inline qasymm8_t qasymm8_hard_swish(qasymm8_t in,
return tmp;
}
+inline qasymm8_signed_t qasymm8_signed_hard_swish(qasymm8_signed_t in,
+ const UniformQuantizationInfo &qi_in,
+ const UniformQuantizationInfo &qi_out)
+{
+ float tmp_f = dequantize_qasymm8_signed(in, qi_in);
+ tmp_f = tmp_f * ((std::min(std::max((tmp_f + 3), 0.0f), 6.0f)) * 0.166666667f);
+ const qasymm8_t tmp = quantize_qasymm8_signed(tmp_f, qi_out);
+ return tmp;
+}
+
inline qasymm8_t qasymm8_leaky_relu(qasymm8_t in,
const UniformQuantizationInfo &qi_in,
const UniformQuantizationInfo &qi_out,