8 Sigmoid<T>::Sigmoid(
double max_abs_err) : tanh_(max_abs_err) {
9 float x_sq = tanh_.GetSaturationRegionBegin();
11 in_qparams_.scale = 2 * x_sq / ((1 << (num_in_bits_ - 1)) - 1);
12 in_qparams_.zero_point = 1 << (num_in_bits_ - 1);
13 in_qparams_.precision = num_in_bits_;
16 out_qparams_.scale = 0.5 / ((1 << (num_out_bits_ - 1)) - 1);
17 out_qparams_.zero_point = 0;
18 out_qparams_.precision = num_out_bits_;
23 T Sigmoid<T>::Compute(
T x)
const {
24 T temp = tanh_.Compute(x);
26 assert(temp < (1 << num_out_bits_));
30 template class Sigmoid<uint8_t>;
31 template class Sigmoid<uint16_t>;
32 template class Sigmoid<int32_t>;