Fixed Softplus ref (#5755)

This commit is contained in:
Alexandra Sidorova 2021-05-24 14:34:12 +03:00 committed by GitHub
parent b87fa84c9f
commit a74ba7b18e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ The `threshold` can be calculated with the following formula where `alpha` is th
-log(e^{10^{-\alpha}} - 1.0) < threshold < log(\beta) -log(e^{10^{-\alpha}} - 1.0) < threshold < log(\beta)
\f] \f]
For example, if *T* is `fp32`, `threshold` should be `20` or if *T* is `fp16`, `threshold` should be `12`. For example, if *T* is `fp32`, `threshold` should be `20` or if *T* is `fp16`, `threshold` should be `11`.
**Attributes**: *SoftPlus* operation has no attributes. **Attributes**: *SoftPlus* operation has no attributes.

View File

@ -16,7 +16,7 @@ namespace ngraph
template <typename T> template <typename T>
void softplus(const T* arg, T* out, size_t count) void softplus(const T* arg, T* out, size_t count)
{ {
const T threshold = static_cast<T>(-std::log(std::exp(std::pow(10, -6)) - 1)); const T threshold = static_cast<T>(std::log(std::numeric_limits<T>::max()));
for (size_t i = 0; i < count; i++) for (size_t i = 0; i < count; i++)
{ {