aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Suharsh Sivakumar <suharshs@google.com>2018-03-27 14:17:16 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-03-27 14:20:15 -0700
commit95f2304c1faf24e9ae2e15cc6dc4b6f7114d1dad (patch)
tree7dac7d279bf5a13e530f55b98b4b077dd2d24584
parent12accfe7d26617797f6f9d63352e09697c6d9455 (diff)
Improve error message when users forget to pass toco cmdline args for quantization, but have a model that has FAKE_QUANT operations.
PiperOrigin-RevId: 190672414
-rw-r--r--tensorflow/contrib/lite/toco/tflite/export.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/tensorflow/contrib/lite/toco/tflite/export.cc b/tensorflow/contrib/lite/toco/tflite/export.cc
index 2771959970..335b496dcc 100644
--- a/tensorflow/contrib/lite/toco/tflite/export.cc
+++ b/tensorflow/contrib/lite/toco/tflite/export.cc
@@ -300,6 +300,17 @@ void Export(const Model& model, bool allow_custom_ops,
std::set<string> error_summary;
auto op_codes = ExportOperatorCodes(model, ops_by_type, operators_map,
&builder, &error_summary);
+ const string fake_quant_operation_name = "FAKE_QUANT";
+ if (error_summary.count(fake_quant_operation_name) != 0) {
+ LOG(ERROR)
+ << fake_quant_operation_name
+ << " operation was not converted. If running quantized make sure you "
+ "are passing --inference_type=QUANTIZED_UINT8 and values for "
+ "--std_values and --mean_values.";
+ // Remove the fake quant operation from the errors, since it shouldn't
+ // be provided a custom implementation.
+ error_summary.erase(fake_quant_operation_name);
+ }
if (!allow_custom_ops && !error_summary.empty()) {
LOG(QFATAL) << "Some of the operators in the model are not supported by "
"the standard TensorFlow Lite runtime. If you have a custom "