SparseAdd

public final class SparseAdd

Adds two `SparseTensor` objects to produce another `SparseTensor`.

The input `SparseTensor` objects' indices are assumed ordered in standard lexicographic order. If this is not the case, before this step run `SparseReorder` to restore index ordering.

By default, if two values sum to zero at some index, the output `SparseTensor` would still include that particular location in its index, storing a zero in the corresponding value slot. To override this, callers can specify `thresh`, indicating that if the sum has a magnitude strictly smaller than `thresh`, its corresponding value and index would then not be included. In particular, `thresh == 0` (default) means everything is kept and actual thresholding happens only for a positive value.

In the following shapes, `nnz` is the count after taking `thresh` into account.

Constants

String OP_NAME The name of this op, as known by TensorFlow core engine

Public Methods

static <T extends TType> SparseAdd<T>
create(Scope scope, Operand<TInt64> aIndices, Operand<T> aValues, Operand<TInt64> aShape, Operand<TInt64> bIndices, Operand<T> bValues, Operand<TInt64> bShape, Operand<? extends TNumber> thresh)
Factory method to create a class wrapping a new SparseAdd operation.
Output<TInt64>
Output<TInt64>
Output<T>

Inherited Methods

Constants

public static final String OP_NAME

The name of this op, as known by TensorFlow core engine

Constant Value: "SparseAdd"

Public Methods

public static SparseAdd<T> create (Scope scope, Operand<TInt64> aIndices, Operand<T> aValues, Operand<TInt64> aShape, Operand<TInt64> bIndices, Operand<T> bValues, Operand<TInt64> bShape, Operand<? extends TNumber> thresh)

Factory method to create a class wrapping a new SparseAdd operation.

Parameters
scope current scope
aIndices 2-D. The `indices` of the first `SparseTensor`, size `[nnz, ndims]` Matrix.
aValues 1-D. The `values` of the first `SparseTensor`, size `[nnz]` Vector.
aShape 1-D. The `shape` of the first `SparseTensor`, size `[ndims]` Vector.
bIndices 2-D. The `indices` of the second `SparseTensor`, size `[nnz, ndims]` Matrix.
bValues 1-D. The `values` of the second `SparseTensor`, size `[nnz]` Vector.
bShape 1-D. The `shape` of the second `SparseTensor`, size `[ndims]` Vector.
thresh 0-D. The magnitude threshold that determines if an output value/index pair takes space.
Returns
  • a new instance of SparseAdd

public Output<TInt64> sumIndices ()

public Output<TInt64> sumShape ()

public Output<T> sumValues ()