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<int>::max`. The restriction is likely unnecesary, due to historical reasons. This fix remove this limitation. This fix fixes 25701. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
parent
b85cb440e2
commit
40e1acd4fc
@ -78,9 +78,6 @@ class SparseDenseBinaryOpShared : public OpKernel {
|
|||||||
"but received shapes: ",
|
"but received shapes: ",
|
||||||
values_t->shape().DebugString(), " and ",
|
values_t->shape().DebugString(), " and ",
|
||||||
shape_t->shape().DebugString()));
|
shape_t->shape().DebugString()));
|
||||||
OP_REQUIRES(ctx, indices_t->dim_size(0) < std::numeric_limits<int>::max(),
|
|
||||||
errors::InvalidArgument(
|
|
||||||
"Number of non-zero elements exceeds int32 range"));
|
|
||||||
|
|
||||||
const auto indices_mat = indices_t->matrix<int64>();
|
const auto indices_mat = indices_t->matrix<int64>();
|
||||||
const auto shape_vec = shape_t->vec<int64>();
|
const auto shape_vec = shape_t->vec<int64>();
|
||||||
@ -106,7 +103,7 @@ class SparseDenseBinaryOpShared : public OpKernel {
|
|||||||
|
|
||||||
Tensor *output_values = nullptr;
|
Tensor *output_values = nullptr;
|
||||||
Tensor dense_gathered;
|
Tensor dense_gathered;
|
||||||
const int nnz = static_cast<int>(indices_t->dim_size(0));
|
const int64 nnz = indices_t->dim_size(0);
|
||||||
OP_REQUIRES_OK(ctx,
|
OP_REQUIRES_OK(ctx,
|
||||||
ctx->allocate_output(0, TensorShape({nnz}), &output_values));
|
ctx->allocate_output(0, TensorShape({nnz}), &output_values));
|
||||||
OP_REQUIRES_OK(
|
OP_REQUIRES_OK(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user