ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more

QuantizedMatMulWithBiasAndRelu

public final class QuantizedMatMulWithBiasAndRelu

Perform a quantized matrix multiplication of `a` by the matrix `b` with bias add and relu fusion.

The inputs must be two-dimensional matrices and 1D bias vector. And the inner dimension of `a` (after being transposed if `transpose_a` is non-zero) must match the outer dimension of `b` (after being transposed if `transposed_b` is non-zero). Then do broadcast add operation with bias values on the matrix multiplication result. The bias size must match inner dimension of `b`. Then do relu activation to get non-negative result.

Nested Classes

class QuantizedMatMulWithBiasAndRelu.Options Optional attributes for QuantizedMatMulWithBiasAndRelu  

Public Methods

static <V, T, U> QuantizedMatMulWithBiasAndRelu<V>
create(Scope scope, Operand<T> a, Operand<U> b, Operand<Float> bias, Operand<Float> minA, Operand<Float> maxA, Operand<Float> minB, Operand<Float> maxB, Class<V> Toutput, Options... options)
Factory method to create a class wrapping a new QuantizedMatMulWithBiasAndRelu operation.
static QuantizedMatMulWithBiasAndRelu.Options
inputQuantMode(String inputQuantMode)
Output<Float>
maxOut()
The float value that the highest quantized output value represents.
Output<Float>
minOut()
The float value that the lowest quantized output value represents.
Output<V>
out()
static QuantizedMatMulWithBiasAndRelu.Options
transposeA(Boolean transposeA)
static QuantizedMatMulWithBiasAndRelu.Options
transposeB(Boolean transposeB)

Inherited Methods

Public Methods

public static QuantizedMatMulWithBiasAndRelu<V> create (Scope scope, Operand<T> a, Operand<U> b, Operand<Float> bias, Operand<Float> minA, Operand<Float> maxA, Operand<Float> minB, Operand<Float> maxB, Class<V> Toutput, Options... options)

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

Parameters
scope current scope
a A matrix to be multiplied. Must be a two-dimensional tensor of type `quint8`.
b A matrix to be multiplied and must be a two-dimensional tensor of type `qint8`.
bias A 1D bias tensor with size matching with inner dimension of `b` (after being transposed if `transposed_b` is non-zero).
minA The float value that the lowest quantized `a` value represents.
maxA The float value that the highest quantized `a` value represents.
minB The float value that the lowest quantized `b` value represents.
maxB The float value that the highest quantized `b` value represents.
options carries optional attributes values
Returns
  • a new instance of QuantizedMatMulWithBiasAndRelu

public static QuantizedMatMulWithBiasAndRelu.Options inputQuantMode (String inputQuantMode)

Parameters
inputQuantMode Input data quantization mode. Either MIN_FIRST(default) or SCALED.

public Output<Float> maxOut ()

The float value that the highest quantized output value represents.

public Output<Float> minOut ()

The float value that the lowest quantized output value represents.

public Output<V> out ()

public static QuantizedMatMulWithBiasAndRelu.Options transposeA (Boolean transposeA)

Parameters
transposeA If true, `a` is transposed before multiplication.

public static QuantizedMatMulWithBiasAndRelu.Options transposeB (Boolean transposeB)

Parameters
transposeB If true, `b` is transposed before multiplication.