aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/toco/graph_transformations/identify_lstm_split_inputs.cc
diff options
context:
space:
mode:
authorGravatar Yu-Cheng Ling <ycling@google.com>2018-10-09 11:38:15 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-09 11:48:46 -0700
commit12e164d1e7c0b197f06d5d3c2ed26318b89b5e4c (patch)
treed2f0b6ba463baff8e3607575f41d3655762f3d14 /tensorflow/contrib/lite/toco/graph_transformations/identify_lstm_split_inputs.cc
parent931353c5f79c2d419afb3a5ecac59184c5558351 (diff)
Return ::tensorflow::Status in Toco Graph Transformations.
PiperOrigin-RevId: 216392908
Diffstat (limited to 'tensorflow/contrib/lite/toco/graph_transformations/identify_lstm_split_inputs.cc')
-rw-r--r--tensorflow/contrib/lite/toco/graph_transformations/identify_lstm_split_inputs.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/tensorflow/contrib/lite/toco/graph_transformations/identify_lstm_split_inputs.cc b/tensorflow/contrib/lite/toco/graph_transformations/identify_lstm_split_inputs.cc
index 46d1fce50e..ad5120e2aa 100644
--- a/tensorflow/contrib/lite/toco/graph_transformations/identify_lstm_split_inputs.cc
+++ b/tensorflow/contrib/lite/toco/graph_transformations/identify_lstm_split_inputs.cc
@@ -25,19 +25,22 @@ limitations under the License.
namespace toco {
-bool SplitLstmCellInputs::Run(Model* model, std::size_t op_index) {
+::tensorflow::Status SplitLstmCellInputs::Run(Model* model,
+ std::size_t op_index,
+ bool* modified) {
+ *modified = false;
// Find lstm cell.
auto op_it = model->operators.begin() + op_index;
auto curr_op = op_it->get();
if (curr_op->type != OperatorType::kLstmCell) {
- return false;
+ return ::tensorflow::Status::OK();
}
const auto* curr_lstm_op = static_cast<LstmCellOperator*>(curr_op);
// Already an extended LstmCell. Do not need to split cell inputs.
if (curr_lstm_op->kernel_type != LstmCellOperator::KERNEL_BASIC ||
curr_lstm_op->inputs.size() != LstmCellOperator::NUM_INPUTS) {
- return false;
+ return ::tensorflow::Status::OK();
}
// Make sure the WEIGHTS_INPUT and BIASES_INPUT are constant arrays,
@@ -46,13 +49,13 @@ bool SplitLstmCellInputs::Run(Model* model, std::size_t op_index) {
*model, curr_op->inputs[LstmCellOperator::WEIGHTS_INPUT]) ||
!IsConstantParameterArray(
*model, curr_op->inputs[LstmCellOperator::BIASES_INPUT])) {
- return false;
+ return ::tensorflow::Status::OK();
}
// Make sure propagate_fixed_sizes has defined the size of the output.
if (!model->GetArray(curr_op->outputs[LstmCellOperator::ACTIV_OUTPUT])
.has_shape()) {
- return false;
+ return ::tensorflow::Status::OK();
}
// Emplace a new LstmCell operator with extended inputs (kernel/lstm.cc).
@@ -168,7 +171,8 @@ bool SplitLstmCellInputs::Run(Model* model, std::size_t op_index) {
DeleteArrayIfUnused(curr_op->inputs[LstmCellOperator::BIASES_INPUT], model);
model->operators.erase(FindOp(*model, curr_op));
- return true;
+ *modified = true;
+ return ::tensorflow::Status::OK();
}
} // namespace toco