QuantizeAndDequantizeV4

public final class QuantizeAndDequantizeV4

Quantizes then dequantizes a tensor.

This is almost identical to QuantizeAndDequantizeV2, except that it returns a gradient of 1 for inputs that are within the quantization range, or 0 otherwise.

Nested Classes

class QuantizeAndDequantizeV4.Options Optional attributes for QuantizeAndDequantizeV4  

Public Methods

Output<T>
asOutput()
Returns the symbolic handle of a tensor.
static QuantizeAndDequantizeV4.Options
axis(Long axis)
static <T extends Number> QuantizeAndDequantizeV4<T>
create(Scope scope, Operand<T> input, Operand<T> inputMin, Operand<T> inputMax, Options... options)
Factory method to create a class wrapping a new QuantizeAndDequantizeV4 operation.
static QuantizeAndDequantizeV4.Options
narrowRange(Boolean narrowRange)
static QuantizeAndDequantizeV4.Options
numBits(Long numBits)
Output<T>
output()
static QuantizeAndDequantizeV4.Options
rangeGiven(Boolean rangeGiven)
static QuantizeAndDequantizeV4.Options
roundMode(String roundMode)
static QuantizeAndDequantizeV4.Options
signedInput(Boolean signedInput)

Inherited Methods

Public Methods

public Output<T> asOutput ()

Returns the symbolic handle of a tensor.

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.

public static QuantizeAndDequantizeV4.Options axis (Long axis)

Parameters
axis If specified, this axis is treated as a channel or slice axis, and a separate quantization range is used for each channel or slice along this axis.

public static QuantizeAndDequantizeV4<T> create (Scope scope, Operand<T> input, Operand<T> inputMin, Operand<T> inputMax, Options... options)

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

Parameters
scope current scope
input Tensor to quantize and then dequantize.
inputMin If `range_given == True`, this specifies the minimum input value that needs to be represented, otherwise it is determined from the min value of the `input` tensor.
inputMax If `range_given == True`, this specifies the maximum input value that needs to be represented, otherwise it is determined from the max value of the `input` tensor.
options carries optional attributes values
Returns
  • a new instance of QuantizeAndDequantizeV4

public static QuantizeAndDequantizeV4.Options narrowRange (Boolean narrowRange)

Parameters
narrowRange If True, then the absolute value of the quantized minimum value is the same as the quantized maximum value, instead of 1 greater. i.e. for 8 bit quantization, the minimum value is -127 instead of -128.

public static QuantizeAndDequantizeV4.Options numBits (Long numBits)

Parameters
numBits The bitwidth of the quantization.

public Output<T> output ()

public static QuantizeAndDequantizeV4.Options rangeGiven (Boolean rangeGiven)

Parameters
rangeGiven Whether the range is given or should be determined from the `input` tensor.

public static QuantizeAndDequantizeV4.Options roundMode (String roundMode)

Parameters
roundMode The 'round_mode' attribute controls which rounding tie-breaking algorithm is used when rounding float values to their quantized equivalents. The following rounding modes are currently supported:
  • HALF_TO_EVEN: this is the default round_mode.
  • HALF_UP: round towards positive. In this mode 7.5 rounds up to 8 and -7.5 rounds up to -7.

public static QuantizeAndDequantizeV4.Options signedInput (Boolean signedInput)

Parameters
signedInput Whether the quantization is signed or unsigned. (actually this parameter should have been called `signed_output`)