aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/toco/graph_transformations/resolve_transpose_attributes.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/resolve_transpose_attributes.cc
parent931353c5f79c2d419afb3a5ecac59184c5558351 (diff)
Return ::tensorflow::Status in Toco Graph Transformations.
PiperOrigin-RevId: 216392908
Diffstat (limited to 'tensorflow/contrib/lite/toco/graph_transformations/resolve_transpose_attributes.cc')
-rw-r--r--tensorflow/contrib/lite/toco/graph_transformations/resolve_transpose_attributes.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/tensorflow/contrib/lite/toco/graph_transformations/resolve_transpose_attributes.cc b/tensorflow/contrib/lite/toco/graph_transformations/resolve_transpose_attributes.cc
index a657ee00af..aa7945391c 100644
--- a/tensorflow/contrib/lite/toco/graph_transformations/resolve_transpose_attributes.cc
+++ b/tensorflow/contrib/lite/toco/graph_transformations/resolve_transpose_attributes.cc
@@ -24,19 +24,24 @@ limitations under the License.
namespace toco {
-bool ResolveTransposeAttributes::Run(Model* model, std::size_t op_index) {
+::tensorflow::Status ResolveTransposeAttributes::Run(Model* model,
+ std::size_t op_index,
+ bool* modified) {
+ *modified = false;
const auto op_it = model->operators.begin() + op_index;
- if (op_it->get()->type != OperatorType::kTranspose) return false;
+ if (op_it->get()->type != OperatorType::kTranspose)
+ return ::tensorflow::Status::OK();
auto* op = static_cast<TransposeOperator*>(op_it->get());
- if (!op->perm.empty()) return false;
+ if (!op->perm.empty()) return ::tensorflow::Status::OK();
CHECK_EQ(op->inputs.size(), 2);
- if (!IsConstantParameterArray(*model, op->inputs[1])) return false;
+ if (!IsConstantParameterArray(*model, op->inputs[1]))
+ return ::tensorflow::Status::OK();
// Handling perm.
const auto& perm_array = model->GetArray(op->inputs[1]);
- if (!perm_array.has_shape()) return false;
+ if (!perm_array.has_shape()) return ::tensorflow::Status::OK();
const std::vector<int>& perm_dims = perm_array.shape().dims();
CHECK_EQ(perm_dims.size(), 1);
@@ -47,7 +52,8 @@ bool ResolveTransposeAttributes::Run(Model* model, std::size_t op_index) {
op->perm.push_back(perm_buffer[i]);
}
- return true;
+ *modified = true;
+ return ::tensorflow::Status::OK();
}
} // namespace toco