Skip to content

Commit be7b286

Browse files
Fix CHECK-failure caused by constant folding code.
We're losing a `const` qualifier here, but unless we get to use more `StatusOr` objects, this is the best alternative. PiperOrigin-RevId: 410072241 Change-Id: I69535c91490f0d23facb9587d2ff59db0782cda6
1 parent 6381a7b commit be7b286

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tensorflow/core/grappler/optimizers/constant_folding.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,12 @@ bool ConstantFolding::IsFoldableUncached(
10171017
}
10181018
}
10191019
for (const auto& output_prop : output_props) {
1020-
const PartialTensorShape output_shape(output_prop.shape());
1020+
PartialTensorShape output_shape;
1021+
if (!PartialTensorShape::BuildPartialTensorShape(output_prop.shape(),
1022+
&output_shape)
1023+
.ok()) {
1024+
return false;
1025+
}
10211026
if (output_shape.IsFullyDefined()) {
10221027
const int64_t num_bytes =
10231028
output_shape.num_elements() * DataTypeSize(output_prop.dtype());

0 commit comments

Comments
 (0)