diff options
author | Louis Verhaard <louis.verhaard@arm.com> | 2020-09-30 12:11:49 +0200 |
---|---|---|
committer | Louis Verhaard <louis.verhaard@arm.com> | 2020-09-30 16:04:23 +0200 |
commit | 8912c5311d4ccf2ad1bbb57fdc71c1f25037f56e (patch) | |
tree | 69f1774a1b6a88ed7e2b0c748d44a8596c29ce93 /ethosu/vela/numeric_util.py | |
parent | 530992a3943eb21e12f6d0e638940d7df27a9f51 (diff) | |
download | ethos-u-vela-8912c5311d4ccf2ad1bbb57fdc71c1f25037f56e.tar.gz |
MLBEDSW-3153: Fix overflow in sigmoid LUT
Overflow could occur in the calculation of the LUT table for sigmoid,
for big negative inputs.
Change-Id: I62a33c68de03e9a7a7e4fe2cbd5835c384dc3643
Signed-off-by: Louis Verhaard <louis.verhaard@arm.com>
Diffstat (limited to 'ethosu/vela/numeric_util.py')
-rw-r--r-- | ethosu/vela/numeric_util.py | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/ethosu/vela/numeric_util.py b/ethosu/vela/numeric_util.py index 3d26444a..4ebef8e5 100644 --- a/ethosu/vela/numeric_util.py +++ b/ethosu/vela/numeric_util.py @@ -77,17 +77,13 @@ def clamp_tanh(x): return y -def sigmoid(x): - return 1 / (1 + math.exp(-x)) - - def clamp_sigmoid(x): if x <= -8: y = 0.0 elif x >= 8: y = 1.0 else: - y = sigmoid(x) + y = 1 / (1 + math.exp(-x)) return y |