Skip to content
Permalink
Browse files Browse the repository at this point in the history
Prevent a null-pointer dereference / CHECK-fail in grappler.
PiperOrigin-RevId: 409187354
Change-Id: I369c249cca32e6c56ec193f0ebbf2f2768fc7d43
  • Loading branch information
mihaimaruseac authored and tensorflower-gardener committed Nov 11, 2021
1 parent 1cda4d4 commit 92dba16
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tensorflow/core/grappler/optimizers/dependency_optimizer.cc
Expand Up @@ -75,8 +75,10 @@ bool DependencyOptimizer::SafeToRemoveIdentity(const NodeDef& node) const {
}

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

0 comments on commit 92dba16

Please sign in to comment.