diff options
author | 2018-10-09 11:38:15 -0700 | |
---|---|---|
committer | 2018-10-09 11:48:46 -0700 | |
commit | 12e164d1e7c0b197f06d5d3c2ed26318b89b5e4c (patch) | |
tree | d2f0b6ba463baff8e3607575f41d3655762f3d14 /tensorflow/contrib/lite/toco/graph_transformations/quantize.cc | |
parent | 931353c5f79c2d419afb3a5ecac59184c5558351 (diff) |
Return ::tensorflow::Status in Toco Graph Transformations.
PiperOrigin-RevId: 216392908
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 |