| 371 | } |
| 372 | |
| 373 | bool CheckedLog2(const float x, int* log2_result) { |
| 374 | // Using TfLiteRound instead of std::round and std::log instead of |
| 375 | // std::log2 to work around these fuctions being missing in a toolchain |
| 376 | // used in some TensorFlow tests as of May 2018. |
| 377 | const float x_log2 = std::log(x) * (1.0f / std::log(2.0f)); |
| 378 | const float x_log2_rounded = TfLiteRound(x_log2); |
| 379 | const float x_log2_fracpart = x_log2 - x_log2_rounded; |
| 380 | |
| 381 | *log2_result = static_cast<int>(x_log2_rounded); |
| 382 | return std::abs(x_log2_fracpart) < 1e-3; |
| 383 | } |
| 384 | |
| 385 | void QuantizeMultiplierArray(const double* effective_scales, size_t size, |
| 386 | int32_t* effective_scale_significand, |
no test coverage detected