We use the 3-region approach described in "Efficient VLSI Implementation of Neural Networks with Hyperbolic Tangent Activation Function", IEEE Transactions on Very Large Scale Integration Systems, Zamanlooy and Mirhassani. More...
#include <tanh.h>
Public Member Functions | |
| Tanh (double max_abs_err=DEFAULT_MAX_ABS_ERR) | |
| T | Compute (T x) const |
| TensorQuantizationParams | GetInputQuantizationParams () const |
| TensorQuantizationParams | GetOutputQuantizationParams () const |
| int | GetPassRegionEnd () const |
| float | GetPassRegionEndDequantized () const |
| float | GetSaturationRegionBegin () const |
Static Public Attributes | |
| static constexpr double | DEFAULT_MAX_ABS_ERR = 0.02 |
| static constexpr int | DEFAULT_NUM_IN_BITS = 8 |
| static constexpr int | DEFAULT_NUM_OUT_BITS = 8 |
We use the 3-region approach described in "Efficient VLSI Implementation of Neural Networks with Hyperbolic Tangent Activation Function", IEEE Transactions on Very Large Scale Integration Systems, Zamanlooy and Mirhassani.
The pass region (x < x_pq) is approximated as x. The saturation region (x >= x_sq) is approximated as 1. The processing region (x_pq <= x < x_sq) is divided into sub-ranges and the average value of tanh(x) is used per sub-range.
1.8.11