diff options
Diffstat (limited to 'tensorflow/contrib/lite/toco/graph_transformations/quantize.cc')
-rw-r--r-- | tensorflow/contrib/lite/toco/graph_transformations/quantize.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tensorflow/contrib/lite/toco/graph_transformations/quantize.cc b/tensorflow/contrib/lite/toco/graph_transformations/quantize.cc index fb299c31b7..29ea17dc61 100644 --- a/tensorflow/contrib/lite/toco/graph_transformations/quantize.cc +++ b/tensorflow/contrib/lite/toco/graph_transformations/quantize.cc @@ -439,7 +439,9 @@ void FixMinMaxPostQuantization(GraphTransformation* transformation, } // namespace -bool Quantize::Run(Model* model, std::size_t op_index) { +::tensorflow::Status Quantize::Run(Model* model, std::size_t op_index, + bool* modified) { + *modified = false; // Our general "quantization" graph transformation consists in replacing // QuantizedInputArrays[] -> // DequantizeOperators[] -> @@ -460,7 +462,7 @@ bool Quantize::Run(Model* model, std::size_t op_index) { auto& op = *model->operators[op_index]; if (op.type == OperatorType::kDequantize || op.type == OperatorType::kFakeQuant) { - return false; + return ::tensorflow::Status::OK(); } // Our assumption here is that the input arrays are already quantized - @@ -497,7 +499,7 @@ bool Quantize::Run(Model* model, std::size_t op_index) { if (!array.minmax && !array.buffer) { LOG(ERROR) << "Can't quantize input array " << input << " because it lacks min/max info"; - return false; + return ::tensorflow::Status::OK(); } const auto* other_op = GetOpWithOutput(*model, input); if (other_op && other_op->type != OperatorType::kDequantize) { @@ -507,7 +509,7 @@ bool Quantize::Run(Model* model, std::size_t op_index) { "which means that we should yield and let other ops " "get quantized first", LogName(op), input); - return false; + return ::tensorflow::Status::OK(); } } } @@ -672,7 +674,8 @@ bool Quantize::Run(Model* model, std::size_t op_index) { } } - return changed; + *modified = changed; + return ::tensorflow::Status::OK(); } } // namespace toco |