Skip to content

Commit

Permalink
Properly handle shape nodes that have a preexisting control dependency
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 158274845
  • Loading branch information
benoitsteiner authored and tensorflower-gardener committed Jun 7, 2017
1 parent 1d67379 commit 3b6fe94
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tensorflow/core/grappler/optimizers/constant_folding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,13 @@ Status ConstantFolding::MaterializeShapes(const GrapplerItem& item) {
value.AsProtoTensorContent(
(*node.mutable_attr())["value"].mutable_tensor());

// Turn the inputs into control dependencies: this is needed to ensure
// that the constant value will only be generated in the cases where the
// shape/rank/size would have been generated in the original graph.
// Turn the data input into a control dependency: this is needed to
// ensure that the constant value will only be generated in the cases
// where the shape/rank/size would have been generated in the original
// graph. Additional inputs are extra control dependencies that we
// preserve.
CHECK_LE(1, node.input_size());
string ctrl_dep = AddControlDependency(node.input(0));
CHECK_EQ(1, node.input_size());
node.set_input(0, ctrl_dep);
}
}
Expand Down

0 comments on commit 3b6fe94

Please sign in to comment.