aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <bsteiner@google.com>2017-06-23 12:51:19 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-06-23 12:55:14 -0700
commit0eff699d3087171cf35671d9d0bd6f8e79441ab3 (patch)
tree21e9a8448aaf932ac1628b5e2b1695f9b0b2dbc0 /tensorflow
parentc1e0d6067c23b0e87c97b17fd0052f438bff76c5 (diff)
Don't crash if a metagraph fails to load.
PiperOrigin-RevId: 159981628
Diffstat (limited to 'tensorflow')
-rw-r--r--tensorflow/core/grappler/grappler_item_builder.cc2
-rw-r--r--tensorflow/python/grappler/cost_analyzer.i5
2 files changed, 5 insertions, 2 deletions
diff --git a/tensorflow/core/grappler/grappler_item_builder.cc b/tensorflow/core/grappler/grappler_item_builder.cc
index 969376917b..c6e3bc626e 100644
--- a/tensorflow/core/grappler/grappler_item_builder.cc
+++ b/tensorflow/core/grappler/grappler_item_builder.cc
@@ -328,7 +328,7 @@ std::unique_ptr<GrapplerItem> GrapplerItemFromMetaGraphDef(
Status optimize_status =
OptimizeGraph(new_item->graph, &new_item->graph, cfg);
if (!optimize_status.ok()) {
- LOG(ERROR) << "Function optimization failed: " << optimize_status;
+ LOG(ERROR) << "Graph preprocessing failed: " << optimize_status;
return nullptr;
}
diff --git a/tensorflow/python/grappler/cost_analyzer.i b/tensorflow/python/grappler/cost_analyzer.i
index 6066b6131f..1f024e439d 100644
--- a/tensorflow/python/grappler/cost_analyzer.i
+++ b/tensorflow/python/grappler/cost_analyzer.i
@@ -48,7 +48,10 @@ per_node_report) {
cfg.apply_optimizations = false;
std::unique_ptr<tensorflow::grappler::GrapplerItem> item =
tensorflow::grappler::GrapplerItemFromMetaGraphDef("metagraph", metagraph, cfg);
-
+ if (!item) {
+ return "Error: failed to preprocess metagraph: check your log file for errors";
+ }
+
// TODO(bsteiner): we should wrap the tf session instead to properly handle the case of a
// distributed setup.
const int timeout_s = 3600;