@Operator(group="sparse") public final class SparseMatMul extends PrimitiveOp implements Operand<Float>
The inputs must be two-dimensional matrices and the inner dimension of "a" must match the outer dimension of "b". Both "a" and "b" must be `Tensor`s not `SparseTensor`s. This op is optimized for the case where at least one of "a" or "b" is sparse, in the sense that they have a large proportion of zero values. The breakeven for using this versus a dense matrix multiply on one platform was 30% zero values in the sparse matrix.
The gradient computation of this operation will only take advantage of sparsity in the input gradient when that gradient comes from a Relu.
Modifier and Type | Class and Description |
---|---|
static class |
SparseMatMul.Options
Optional attributes for
SparseMatMul |
operation
Modifier and Type | Method and Description |
---|---|
static SparseMatMul.Options |
aIsSparse(Boolean aIsSparse) |
Output<Float> |
asOutput()
Returns the symbolic handle of a tensor.
|
static SparseMatMul.Options |
bIsSparse(Boolean bIsSparse) |
static <T extends Number,U extends Number> |
create(Scope scope,
Operand<T> a,
Operand<U> b,
SparseMatMul.Options... options)
Factory method to create a class wrapping a new SparseMatMul operation.
|
Output<Float> |
product() |
static SparseMatMul.Options |
transposeA(Boolean transposeA) |
static SparseMatMul.Options |
transposeB(Boolean transposeB) |
equals, hashCode, op, toString
public static <T extends Number,U extends Number> SparseMatMul create(Scope scope, Operand<T> a, Operand<U> b, SparseMatMul.Options... options)
scope
- current scopea
- b
- options
- carries optional attributes valuespublic static SparseMatMul.Options transposeA(Boolean transposeA)
transposeA
- public static SparseMatMul.Options transposeB(Boolean transposeB)
transposeB
- public static SparseMatMul.Options aIsSparse(Boolean aIsSparse)
aIsSparse
- public static SparseMatMul.Options bIsSparse(Boolean bIsSparse)
bIsSparse
- public Output<Float> asOutput()
Operand
Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is used to obtain a symbolic handle that represents the computation of the input.
asOutput
in interface Operand<Float>
OperationBuilder.addInput(Output)
Copyright © 2022. All rights reserved.