Skip to content

Commit 8e55a91

Browse files
Fix overflow CHECK issue with tf.raw_ops.AddManySparseToTensorsMap.
PiperOrigin-RevId: 369572755 Change-Id: Ib054995f5564a15304772c77a27fbef93c7ce9a7
1 parent 979c509 commit 8e55a91

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

tensorflow/core/kernels/sparse_concat_op.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ limitations under the License.
2727
#include "tensorflow/core/framework/tensor_util.h"
2828
#include "tensorflow/core/framework/types.h"
2929
#include "tensorflow/core/lib/gtl/inlined_vector.h"
30-
#include "tensorflow/core/util/overflow.h"
3130
#include "tensorflow/core/util/sparse/sparse_tensor.h"
3231

3332
namespace tensorflow {
@@ -68,25 +67,10 @@ class SparseConcatOp : public OpKernel {
6867
errors::InvalidArgument("Expected ", N, " input shapes, got ",
6968
shapes.size()));
7069
for (int i = 0; i < N; i++) {
71-
int new_num_elements = 1;
72-
bool overflow_ocurred = false;
7370
OP_REQUIRES(context, TensorShapeUtils::IsVector(shapes[i].shape()),
7471
errors::InvalidArgument(
7572
"Input shapes should be a vector but received shape ",
7673
shapes[i].shape().DebugString(), " at position ", i));
77-
auto input_shape_vector = shapes[i].vec<int64>();
78-
for (int j = 0; j < input_shape_vector.size(); j++) {
79-
new_num_elements =
80-
MultiplyWithoutOverflow(new_num_elements, input_shape_vector(j));
81-
if (new_num_elements < 0) {
82-
overflow_ocurred = true;
83-
break;
84-
}
85-
}
86-
87-
OP_REQUIRES(
88-
context, !overflow_ocurred,
89-
errors::Internal("Encountered overflow from large input shape."));
9074
}
9175

9276
const TensorShape input_shape(shapes[0].vec<int64>());

0 commit comments

Comments
 (0)