aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/grappler/costs/op_level_cost_estimator.cc
diff options
context:
space:
mode:
authorGravatar Max Galkin <maxgalkin@google.com>2017-11-23 16:48:38 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-11-23 16:52:14 -0800
commitfed333479868935d24ec104b2ce9e9ac5dadf565 (patch)
tree4e8f3b288ed2b8d7508ade45103fe1a949ee48b9 /tensorflow/core/grappler/costs/op_level_cost_estimator.cc
parent742ca716334886b78b7ccc4cbecb33ad13c27cd5 (diff)
Some extra checks and warnings in grappler to provide more helpful error messages when inputs are imperfect (cost_graph is empty and it causes graph_properties to be empty).
PiperOrigin-RevId: 176796142
Diffstat (limited to 'tensorflow/core/grappler/costs/op_level_cost_estimator.cc')
-rw-r--r--tensorflow/core/grappler/costs/op_level_cost_estimator.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/tensorflow/core/grappler/costs/op_level_cost_estimator.cc b/tensorflow/core/grappler/costs/op_level_cost_estimator.cc
index f7905d7798..b1e04ceec8 100644
--- a/tensorflow/core/grappler/costs/op_level_cost_estimator.cc
+++ b/tensorflow/core/grappler/costs/op_level_cost_estimator.cc
@@ -510,7 +510,12 @@ int64 OpLevelCostEstimator::CountMatMulOperations(
bool* found_unknown_shapes) const {
double ops = 0;
- // first matrix
+ if (op_features.inputs_size() < 2) {
+ LOG(ERROR) << "Need 2 inputs but got " << op_features.inputs_size();
+ *found_unknown_shapes = true;
+ return 0;
+ }
+
auto& a_matrix = op_features.inputs(0);
auto& b_matrix = op_features.inputs(1);