Skip to content
Permalink
Browse files Browse the repository at this point in the history
Prevent overflow in sparse dense cwise ops.
PiperOrigin-RevId: 415543171
Change-Id: I22dab7c41be2121ab5efe5403ca0e2f9b7cb24b8
  • Loading branch information
mihaimaruseac authored and tensorflower-gardener committed Dec 10, 2021
1 parent 1b54cad commit e952a89
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tensorflow/core/kernels/sparse_dense_binary_op_shared.cc
Expand Up @@ -99,7 +99,9 @@ class SparseDenseBinaryOpShared : public OpKernel {

const auto indices_mat = indices_t->matrix<int64_t>();
const auto shape_vec = shape_t->vec<int64_t>();
const auto lhs_dims = BCast::FromShape(TensorShape(shape_vec));
TensorShape lhs_shape;
OP_REQUIRES_OK(ctx, TensorShape::BuildTensorShape(shape_vec, &lhs_shape));
const auto lhs_dims = BCast::FromShape(lhs_shape);
const auto rhs_dims = BCast::FromShape(dense_t->shape());
BCast b(lhs_dims, rhs_dims, false); // false for keeping the same num dims.

Expand Down

0 comments on commit e952a89

Please sign in to comment.