T
- data type for sumValues()
output@Operator(group="sparse") public final class SparseAdd<T> extends PrimitiveOp
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.
operation
Modifier and Type | Method and Description |
---|---|
static <T,U extends Number> |
create(Scope scope,
Operand<Long> aIndices,
Operand<T> aValues,
Operand<Long> aShape,
Operand<Long> bIndices,
Operand<T> bValues,
Operand<Long> bShape,
Operand<U> thresh)
Factory method to create a class wrapping a new SparseAdd operation.
|
Output<Long> |
sumIndices() |
Output<Long> |
sumShape() |
Output<T> |
sumValues() |
equals, hashCode, op, toString
public static <T,U extends Number> SparseAdd<T> create(Scope scope, Operand<Long> aIndices, Operand<T> aValues, Operand<Long> aShape, Operand<Long> bIndices, Operand<T> bValues, Operand<Long> bShape, Operand<U> thresh)
scope
- current scopeaIndices
- 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.Copyright © 2022. All rights reserved.