Skip to content

Commit da5ff2d

Browse files
Amit Patankartensorflower-gardener
Amit Patankar
authored andcommitted
Fix FPE issue with tf.raw_ops.DenseCountSparseOutput.
PiperOrigin-RevId: 370946862 Change-Id: I3752584ad04aaecb327ff6793a9640ac56acfe7a
1 parent efff014 commit da5ff2d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: tensorflow/core/kernels/count_ops.cc

+3
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ class DenseCount : public OpKernel {
122122

123123
int num_batch_elements = 1;
124124
for (int i = 0; i < num_batch_dimensions; ++i) {
125+
OP_REQUIRES(context, data.shape().dim_size(i) != 0,
126+
errors::InvalidArgument(
127+
"Invalid input: Shapes dimension cannot be 0."));
125128
num_batch_elements *= data.shape().dim_size(i);
126129
}
127130
int num_value_elements = data.shape().num_elements() / num_batch_elements;

0 commit comments

Comments
 (0)