Skip to content

Commit

Permalink
Merge pull request #54018 from pranve/cherrypick-1fb27733f943295d8744…
Browse files Browse the repository at this point in the history
…17630edd3b38b34ce082-on-r2.7

Remove `CHECK`-fails from `IsSimplifiableReshape`
  • Loading branch information
mihaimaruseac committed Jan 26, 2022
2 parents 0b551d0 + 3b824ae commit c6a5fa0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tensorflow/core/grappler/optimizers/constant_folding.cc
Expand Up @@ -1689,7 +1689,11 @@ bool ConstantFolding::IsSimplifiableReshape(
if (!IsReshape(node)) {
return false;
}
CHECK_LE(2, node.input_size());
if (2 > node.input_size()) {
return errors::Internal("Node ", node.name(),
" must have at most 2 inputs but has ",
node.input_size());
}
const NodeDef* new_shape = node_map_->GetNode(node.input(1));
if (!IsReallyConstant(*new_shape)) {
return false;
Expand All @@ -1705,7 +1709,11 @@ bool ConstantFolding::IsSimplifiableReshape(
if (!s.ok()) {
return false;
}
CHECK_EQ(1, outputs.size());
if (outputs.size() != 1) {
return errors::Internal("Node ", node.name(),
" must have exactly 1 output but has ",
outputs.size());
}

const std::vector<OpInfo::TensorProperties>& props =
properties.GetInputProperties(node.name());
Expand Down

0 comments on commit c6a5fa0

Please sign in to comment.