diff options
Diffstat (limited to 'tensorflow/contrib/lite/toco/graph_transformations/resolve_padv2_attributes.cc')
-rw-r--r-- | tensorflow/contrib/lite/toco/graph_transformations/resolve_padv2_attributes.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tensorflow/contrib/lite/toco/graph_transformations/resolve_padv2_attributes.cc b/tensorflow/contrib/lite/toco/graph_transformations/resolve_padv2_attributes.cc index ebb023e342..1f0f17a37a 100644 --- a/tensorflow/contrib/lite/toco/graph_transformations/resolve_padv2_attributes.cc +++ b/tensorflow/contrib/lite/toco/graph_transformations/resolve_padv2_attributes.cc @@ -24,19 +24,23 @@ limitations under the License. namespace toco { -bool ResolvePadV2Attributes::Run(Model* model, std::size_t op_index) { +::tensorflow::Status ResolvePadV2Attributes::Run(Model* model, + std::size_t op_index, + bool* modified) { + *modified = false; const auto pad_it = model->operators.begin() + op_index; auto* pad_op = pad_it->get(); - if (pad_op->type != OperatorType::kPadV2) return false; + if (pad_op->type != OperatorType::kPadV2) return ::tensorflow::Status::OK(); auto* op = static_cast<PadV2Operator*>(pad_op); - if (!op->left_padding.empty()) return false; + if (!op->left_padding.empty()) return ::tensorflow::Status::OK(); CHECK_EQ(op->inputs.size(), 3); - if (!IsConstantParameterArray(*model, op->inputs[1])) return false; + if (!IsConstantParameterArray(*model, op->inputs[1])) + return ::tensorflow::Status::OK(); const auto& array = model->GetArray(op->inputs[1]); - if (!array.has_shape()) return false; + if (!array.has_shape()) return ::tensorflow::Status::OK(); const std::vector<int>& dims = array.shape().dims(); CHECK_EQ(dims.size(), 2); @@ -50,6 +54,7 @@ bool ResolvePadV2Attributes::Run(Model* model, std::size_t op_index) { // TODO(dkalenichenko): Delete the extra input? - return true; + *modified = true; + return ::tensorflow::Status::OK(); } } // namespace toco |