aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorSang-Hoon Park <sang-hoon.park@arm.com>2020-04-18 01:40:57 +0100
committerSang-Hoon Park <sang-hoon.park@arm.com>2020-04-20 14:53:23 +0000
commit30b46a660629ccd5bf715f63b90d6d7655416e2c (patch)
tree9d30cb7d4950d4f21d0033c9d88c842c587f5a51 /arm_compute
parenteb65f6da695ac0d3e495817145cceb1c4de4f048 (diff)
downloadComputeLibrary-30b46a660629ccd5bf715f63b90d6d7655416e2c.tar.gz
COMPMID-3241: Fix hidden scale in NEQLSTMLayer
- Fix wrong data types in LSTMParams - Add logic to ignore epsilon for quantization multiplier computation - Ignore epsilon for hidden gate scale computation Change-Id: Ia0b2f523b1c2ad325f3523439a8eea051d81958c Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3058 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 'arm_compute')
-rw-r--r--arm_compute/core/utils/quantization/AsymmHelpers.h6
-rw-r--r--arm_compute/runtime/common/LSTMParams.h8
2 files changed, 8 insertions, 6 deletions
diff --git a/arm_compute/core/utils/quantization/AsymmHelpers.h b/arm_compute/core/utils/quantization/AsymmHelpers.h
index a7bbf9b137..4ef49476b2 100644
--- a/arm_compute/core/utils/quantization/AsymmHelpers.h
+++ b/arm_compute/core/utils/quantization/AsymmHelpers.h
@@ -37,19 +37,21 @@ namespace quantization
* @param[in] multiplier Real multiplier.
* @param[out] quant_multiplier Integer multiplier.
* @param[out] shift bit shift. A negative value indicates a left shift, while a positive value indicates a right shift
+ * @param[in] ignore_epsilon When true, ignore pre-defined epsilon value. Defaults to false
*
* @return a status
*/
-Status calculate_quantized_multiplier(float multiplier, int32_t *quant_multiplier, int32_t *shift);
+Status calculate_quantized_multiplier(float multiplier, int32_t *quant_multiplier, int32_t *shift, bool ignore_epsilon = false);
/** Calculate quantized representation of multiplier with value less than one.
*
* @param[in] multiplier Real multiplier.
* @param[out] quant_multiplier Integer multiplier.
* @param[out] right_shift Right bit shift.
+ * @param[in] ignore_epsilon When true, ignore pre-defined epsilon value. Defaults to false
*
* @return a status
*/
-Status calculate_quantized_multiplier_less_than_one(float multiplier, int32_t *quant_multiplier, int32_t *right_shift);
+Status calculate_quantized_multiplier_less_than_one(float multiplier, int32_t *quant_multiplier, int32_t *right_shift, bool ignore_epsilon = false);
/** Calculate quantized representation of multiplier having value greater than one.
*
* @param[in] multiplier Real multiplier.
diff --git a/arm_compute/runtime/common/LSTMParams.h b/arm_compute/runtime/common/LSTMParams.h
index e21ddd7af1..5e4a76afae 100644
--- a/arm_compute/runtime/common/LSTMParams.h
+++ b/arm_compute/runtime/common/LSTMParams.h
@@ -58,8 +58,8 @@ public:
_forget_intermediate_scale(0.0f),
_cell_intermediate_scale(0.0f),
_output_intermediate_scale(0.0f),
- _hidden_state_zero(0.0f),
- _hidden_state_scale(0),
+ _hidden_state_zero(0),
+ _hidden_state_scale(0.0f),
_has_peephole_opt(false),
_has_projection(false),
_has_cifg_opt(true),
@@ -333,8 +333,8 @@ private:
float _forget_intermediate_scale;
float _cell_intermediate_scale;
float _output_intermediate_scale;
- float _hidden_state_zero;
- int32_t _hidden_state_scale;
+ int32_t _hidden_state_zero;
+ float _hidden_state_scale;
bool _has_peephole_opt;
bool _has_projection;
bool _has_cifg_opt;