tf.raw_ops.SparseReduceSumSparse

Computes the sum of elements across dimensions of a SparseTensor.

tf.raw_ops.SparseReduceSumSparse(
    input_indices, input_values, input_shape, reduction_axes, keep_dims=False,
    name=None
)

This Op takes a SparseTensor and is the sparse counterpart to tf.reduce_sum(). In contrast to SparseReduceSum, this Op returns a SparseTensor.

Reduces sp_input along the dimensions given in reduction_axes. Unless keep_dims is true, the rank of the tensor is reduced by 1 for each entry in reduction_axes. If keep_dims is true, the reduced dimensions are retained with length 1.

If reduction_axes has no entries, all dimensions are reduced, and a tensor with a single element is returned. Additionally, the axes can be negative, which are interpreted according to the indexing rules in Python.

Args:

  • input_indices: A Tensor of type int64. 2-D. N x R matrix with the indices of non-empty values in a SparseTensor, possibly not in canonical ordering.
  • input_values: A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, complex64, int64, qint8, quint8, qint32, bfloat16, uint16, complex128, half, uint32, uint64. 1-D. N non-empty values corresponding to input_indices.
  • input_shape: A Tensor of type int64. 1-D. Shape of the input SparseTensor.
  • reduction_axes: A Tensor of type int32. 1-D. Length-K vector containing the reduction axes.
  • keep_dims: An optional bool. Defaults to False. If true, retain reduced dimensions with length 1.
  • name: A name for the operation (optional).

Returns:

A tuple of Tensor objects (output_indices, output_values, output_shape).

  • output_indices: A Tensor of type int64.
  • output_values: A Tensor. Has the same type as input_values.
  • output_shape: A Tensor of type int64.