From 12e164d1e7c0b197f06d5d3c2ed26318b89b5e4c Mon Sep 17 00:00:00 2001 From: Yu-Cheng Ling Date: Tue, 9 Oct 2018 11:38:15 -0700 Subject: Return ::tensorflow::Status in Toco Graph Transformations. PiperOrigin-RevId: 216392908 --- .../toco/graph_transformations/remove_final_dequantize_op.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tensorflow/contrib/lite/toco/graph_transformations/remove_final_dequantize_op.cc') diff --git a/tensorflow/contrib/lite/toco/graph_transformations/remove_final_dequantize_op.cc b/tensorflow/contrib/lite/toco/graph_transformations/remove_final_dequantize_op.cc index c3b2709a33..fe8023ab8f 100644 --- a/tensorflow/contrib/lite/toco/graph_transformations/remove_final_dequantize_op.cc +++ b/tensorflow/contrib/lite/toco/graph_transformations/remove_final_dequantize_op.cc @@ -25,11 +25,14 @@ limitations under the License. namespace toco { -bool RemoveFinalDequantizeOp::Run(Model* model, std::size_t op_index) { +::tensorflow::Status RemoveFinalDequantizeOp::Run(Model* model, + std::size_t op_index, + bool* modified) { + *modified = false; const auto dequantize_it = model->operators.begin() + op_index; const auto* dequantize_op = dequantize_it->get(); if (dequantize_op->type != OperatorType::kDequantize) { - return false; + return ::tensorflow::Status::OK(); } const auto& output = dequantize_op->outputs[0]; // We can remove any dequantize op whose output is not consumed by @@ -38,7 +41,7 @@ bool RemoveFinalDequantizeOp::Run(Model* model, std::size_t op_index) { // in the middle of the graph might be designated as an output // array. if (CountOpsWithInput(*model, output)) { - return false; + return ::tensorflow::Status::OK(); } // If one of the model's output arrays was actually the Dequantize op's @@ -53,7 +56,8 @@ bool RemoveFinalDequantizeOp::Run(Model* model, std::size_t op_index) { AddMessageF("Removed final %s", LogName(*dequantize_op)); model->EraseArray(output); model->operators.erase(dequantize_it); - return true; + *modified = true; + return ::tensorflow::Status::OK(); } } // namespace toco -- cgit v1.2.3