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

Function GetQuantizationFromLegacy

tensorflow/lite/interpreter.cc:56–69  ·  view source on GitHub ↗

Gets the current TfLiteQuantization from the legacy fLiteQuantizationParams.

Source from the content-addressed store, hash-verified

54
55// Gets the current TfLiteQuantization from the legacy fLiteQuantizationParams.
56TfLiteQuantization GetQuantizationFromLegacy(
57 const TfLiteQuantizationParams& legacy_quantization) {
58 TfLiteQuantization quantization;
59 quantization.type = kTfLiteAffineQuantization;
60 auto* affine_quantization = reinterpret_cast<TfLiteAffineQuantization*>(
61 malloc(sizeof(TfLiteAffineQuantization)));
62 affine_quantization->scale = TfLiteFloatArrayCreate(1);
63 affine_quantization->zero_point = TfLiteIntArrayCreate(1);
64 affine_quantization->scale->data[0] = legacy_quantization.scale;
65 affine_quantization->zero_point->data[0] = legacy_quantization.zero_point;
66 quantization.params = affine_quantization;
67
68 return quantization;
69}
70
71} // namespace
72

Callers 2

Calls 2

TfLiteFloatArrayCreateFunction · 0.85
TfLiteIntArrayCreateFunction · 0.85

Tested by

no test coverage detected