Skip to content

Commit 92dba16

Browse files
Prevent a null-pointer dereference / CHECK-fail in grappler.
PiperOrigin-RevId: 409187354 Change-Id: I369c249cca32e6c56ec193f0ebbf2f2768fc7d43
1 parent 1cda4d4 commit 92dba16

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tensorflow/core/grappler/optimizers/dependency_optimizer.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ bool DependencyOptimizer::SafeToRemoveIdentity(const NodeDef& node) const {
7575
}
7676

7777
const NodeDef* input = node_map_->GetNode(NodeName(node.input(0)));
78-
CHECK(input != nullptr) << "node = " << node.name()
79-
<< " input = " << node.input(0);
78+
if (input == nullptr) {
79+
VLOG(1) << "node = " << node.name() << " input = " << node.input(0);
80+
return false;
81+
}
8082
// Don't remove Identity nodes corresponding to Variable reads or following
8183
// Recv.
8284
if (IsVariable(*input) || IsRecv(*input)) {

0 commit comments

Comments
 (0)