MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CheckedLog2

Function CheckedLog2

tensorflow/lite/kernels/internal/quantization_util.cc:373–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371}
372
373bool 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
385void QuantizeMultiplierArray(const double* effective_scales, size_t size,
386 int32_t* effective_scale_significand,

Callers 5

PrepareFunction · 0.85
TanhPrepareFunction · 0.85
SigmoidPrepareFunction · 0.85
PrepareInt16SubOpFunction · 0.85
EvalFunction · 0.85

Calls 3

TfLiteRoundFunction · 0.85
logFunction · 0.50
absFunction · 0.50

Tested by

no test coverage detected