tensorflow:: ops:: QuantizeAndDequantizeV4
#include <array_ops.h>
Quantizes then dequantizes a tensor.
Summary
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.
Args:
- scope: A Scope object
- input: Tensor to quantize and then dequantize.
- input_min: If
range_given == True
, this specifies the minimum input value that needs to be represented, otherwise it is determined from the min value of theinput
tensor. - input_max: If
range_given == True
, this specifies the maximum input value that needs to be represented, otherwise it is determined from the max value of theinput
tensor.
Optional attributes (see Attrs
):
- signed_input: Whether the quantization is signed or unsigned. (actually this parameter should have been called
signed_output
) - num_bits: The bitwidth of the quantization.
- range_given: Whether the range is given or should be determined from the
input
tensor. - round_mode: 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.
- narrow_range: 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.
- 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.
Returns:
Output
: The output tensor.
Constructors and Destructors |
|
---|---|
QuantizeAndDequantizeV4(const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input input_min, ::tensorflow::Input input_max)
|
|
QuantizeAndDequantizeV4(const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input input_min, ::tensorflow::Input input_max, const QuantizeAndDequantizeV4::Attrs & attrs)
|
Public attributes |
|
---|---|
operation
|
|
output
|
Public functions |
|
---|---|
node() const
|
::tensorflow::Node *
|
operator::tensorflow::Input() const
|
|
operator::tensorflow::Output() const
|
|
Public static functions |
|
---|---|
Axis(int64 x)
|
|
NarrowRange(bool x)
|
|
NumBits(int64 x)
|
|
RangeGiven(bool x)
|
|
RoundMode(StringPiece x)
|
|
SignedInput(bool x)
|
Structs |
|
---|---|
tensorflow:: |
Optional attribute setters for QuantizeAndDequantizeV4. |
Public attributes
operation
Operation operation
output
::tensorflow::Output output
Public functions
QuantizeAndDequantizeV4
QuantizeAndDequantizeV4( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input input_min, ::tensorflow::Input input_max )
QuantizeAndDequantizeV4
QuantizeAndDequantizeV4( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input input_min, ::tensorflow::Input input_max, const QuantizeAndDequantizeV4::Attrs & attrs )
node
::tensorflow::Node * node() const
operator::tensorflow::Input
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Public static functions
Axis
Attrs Axis( int64 x )
NarrowRange
Attrs NarrowRange( bool x )
NumBits
Attrs NumBits( int64 x )
RangeGiven
Attrs RangeGiven( bool x )
RoundMode
Attrs RoundMode( StringPiece x )
SignedInput
Attrs SignedInput( bool x )