From 40e1acd4fc8937ea9690d65857c933c7d555bd1f Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Tue, 12 Feb 2019 21:02:12 +0000 Subject: [PATCH] Remove the limitation of int max for dim_size in SparseDenseCwise ops This fix tries to address the issue raised in 25701 where the dim_size in SparseDenseCwise ops was set to `std::numeric_limits::max`. The restriction is likely unnecesary, due to historical reasons. This fix remove this limitation. This fix fixes 25701. Signed-off-by: Yong Tang --- tensorflow/core/kernels/sparse_dense_binary_op_shared.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tensorflow/core/kernels/sparse_dense_binary_op_shared.cc b/tensorflow/core/kernels/sparse_dense_binary_op_shared.cc index a4e89f439ed..af69ae9ebd5 100644 --- a/tensorflow/core/kernels/sparse_dense_binary_op_shared.cc +++ b/tensorflow/core/kernels/sparse_dense_binary_op_shared.cc @@ -78,9 +78,6 @@ class SparseDenseBinaryOpShared : public OpKernel { "but received shapes: ", values_t->shape().DebugString(), " and ", shape_t->shape().DebugString())); - OP_REQUIRES(ctx, indices_t->dim_size(0) < std::numeric_limits::max(), - errors::InvalidArgument( - "Number of non-zero elements exceeds int32 range")); const auto indices_mat = indices_t->matrix(); const auto shape_vec = shape_t->vec(); @@ -106,7 +103,7 @@ class SparseDenseBinaryOpShared : public OpKernel { Tensor *output_values = nullptr; Tensor dense_gathered; - const int nnz = static_cast(indices_t->dim_size(0)); + const int64 nnz = indices_t->dim_size(0); OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({nnz}), &output_values)); OP_REQUIRES_OK(