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

Function Quantize

tensorflow/lite/kernels/test_util.h:46–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44
45template <typename T>
46inline std::vector<T> Quantize(const std::vector<float>& data, float scale,
47 int32_t zero_point) {
48 std::vector<T> q;
49 for (const auto& f : data) {
50 q.push_back(static_cast<T>(std::max<float>(
51 std::numeric_limits<T>::min(),
52 std::min<float>(std::numeric_limits<T>::max(),
53 std::round(zero_point + (f / scale))))));
54 }
55 return q;
56}
57
58template <typename T>
59inline std::vector<float> Dequantize(const std::vector<T>& data, float scale,

Callers

nothing calls this directly

Calls 4

minFunction · 0.50
maxFunction · 0.50
roundFunction · 0.50
push_backMethod · 0.45

Tested by

no test coverage detected