aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/common_runtime
diff options
context:
space:
mode:
authorGravatar Tong Shen <endlessroad@google.com>2018-09-24 21:24:39 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-24 21:27:55 -0700
commit9875df75c308d7498e601ae9a4b57db6aad47056 (patch)
treef3065e2abfa83d21665059ea56c5e0aae162fae7 /tensorflow/core/common_runtime
parentdf90003a68bcb813843e447d6fa2c49deccc48b6 (diff)
Do not assume Node.in_edges() is sorted by dst_input.
PiperOrigin-RevId: 214380876
Diffstat (limited to 'tensorflow/core/common_runtime')
-rw-r--r--tensorflow/core/common_runtime/constant_folding.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/tensorflow/core/common_runtime/constant_folding.cc b/tensorflow/core/common_runtime/constant_folding.cc
index 97b6971c5b..99cb9ac6a0 100644
--- a/tensorflow/core/common_runtime/constant_folding.cc
+++ b/tensorflow/core/common_runtime/constant_folding.cc
@@ -61,6 +61,7 @@ bool ReadPartialShapesFromShapeMap(
shape_map,
std::vector<PartialTensorShape>* input_shapes) {
CHECK(shape_map != nullptr);
+ input_shapes->resize(n->num_inputs());
for (const Edge* in : n->in_edges()) {
// Don't need to check if incoming control edges have known shapes.
if (in->IsControlEdge()) continue;
@@ -71,7 +72,9 @@ bool ReadPartialShapesFromShapeMap(
}
const auto& known_shape = known_shape_iter->second;
CHECK_GT(known_shape.size(), in->src_output()) << known_shape_iter->first;
- input_shapes->push_back(known_shape[in->src_output()]);
+ DCHECK_GE(in->dst_input(), 0);
+ DCHECK_LT(in->dst_input(), input_shapes->size());
+ (*input_shapes)[in->dst_input()] = known_shape[in->src_output()];
}
return true;
}