| 40 | }; |
| 41 | |
| 42 | inline float16_t activation(float16_t x, const LUTInfo &info) |
| 43 | { |
| 44 | float16_t out = 0.f; |
| 45 | switch (info.act) |
| 46 | { |
| 47 | case ActivationLayerInfo::ActivationFunction::LOGISTIC: |
| 48 | out = 1.f / (1.f + std::exp(-x)); |
| 49 | break; |
| 50 | case ActivationLayerInfo::ActivationFunction::TANH: |
| 51 | { |
| 52 | out = static_cast<float16_t>(info.alpha * std::tanh(info.beta * x)); |
| 53 | break; |
| 54 | } |
| 55 | default: |
| 56 | ARM_COMPUTE_ERROR("Unsupported Activation for 16-bit LUT table"); |
| 57 | break; |
| 58 | } |
| 59 | return out; |
| 60 | } |
| 61 | |
| 62 | inline float exponential(float fp, const LUTInfo &info) |
| 63 | { |