Add more details for quantization failure error message

PiperOrigin-RevId: 305727582
Change-Id: I360dd94e03ae867972db502879d043c7e801ac60
This commit is contained in:
Karim Nosir 2020-04-09 11:47:16 -07:00 committed by TensorFlower Gardener
parent 15d75b1ad1
commit a6e10b6e09

View File

@ -1001,9 +1001,20 @@ TfLiteStatus FillQuantizationParams(
// Dynamic tensor. // Dynamic tensor.
} else if (!utils::HasMinMax(tensor) && } else if (!utils::HasMinMax(tensor) &&
!utils::HasBuffer(model, subgraph, tensor_idx)) { !utils::HasBuffer(model, subgraph, tensor_idx)) {
TF_LITE_REPORT_ERROR(error_reporter, TF_LITE_REPORT_ERROR(
"Max and min for dynamic tensors should be" error_reporter,
" recorded during calibration"); "Max and min for dynamic tensors should be"
" recorded during calibration: Failed for tensor %s\n",
tensor->name.c_str());
if (tensor->quantization == nullptr) {
TF_LITE_REPORT_ERROR(error_reporter,
"No quantization params for tensor %s",
tensor->name.c_str());
} else if (tensor->quantization->min.empty() ||
tensor->quantization->max.empty()) {
TF_LITE_REPORT_ERROR(error_reporter, "Empty min/max for tensor %s",
tensor->name.c_str());
}
return kTfLiteError; return kTfLiteError;
} }