Stay organized with collections
Save and categorize content based on your preferences.
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 the input
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 the input
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:
Public attributes
Public functions
node
::tensorflow::Node * node() const
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
)
Attrs SignedInput(
bool x
)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2021-11-15 UTC.
[null,null,["Last updated 2021-11-15 UTC."],[],[],null,["# tensorflow::ops::QuantizeAndDequantizeV4 Class Reference\n\ntensorflow::ops::QuantizeAndDequantizeV4\n========================================\n\n`#include \u003carray_ops.h\u003e`\n\nQuantizes then dequantizes a tensor.\n\nSummary\n-------\n\nThis is almost identical to [QuantizeAndDequantizeV2](/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v2#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v2), except that it returns a gradient of 1 for inputs that are within the quantization range, or 0 otherwise.\n\nArgs:\n\n- scope: A [Scope](/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input: [Tensor](/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor) to quantize and then dequantize.\n- 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 the `input` tensor.\n- 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 the `input` tensor.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs)):\n\n- signed_input: Whether the quantization is signed or unsigned. (actually this parameter should have been called **`signed_output`**)\n- num_bits: The bitwidth of the quantization.\n- range_given: Whether the range is given or should be determined from the `input` tensor.\n- 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:\n- HALF_TO_EVEN: this is the default round_mode.\n- HALF_UP: round towards positive. In this mode 7.5 rounds up to 8 and -7.5 rounds up to -7.\n- 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.\n- 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.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): The output tensor.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [QuantizeAndDequantizeV4](#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1adf55b9a7b0c3fa2453f41c8dbf1a5efe)`(const ::`[tensorflow::Scope](/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_min, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_max)` ||\n| [QuantizeAndDequantizeV4](#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1ad468066168d14743d1848d5071f8ae62)`(const ::`[tensorflow::Scope](/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_min, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_max, const `[QuantizeAndDequantizeV4::Attrs](/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1acc1392aae55ad8bb0568d36a666ae25c) | [Operation](/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1a7262a1066f9e9739306a7ab4708f7565) | `::`[tensorflow::Output](/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|--------------------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1af8b0df43395454f3df89a8c20a4c3d60)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1ac4a46ea522efb956a6b595c85d366c13)`() const ` | |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1a181936ef24e93066a7e9f65bcf9a4aa3)`() const ` | |\n\n| ### Public static functions ||\n|-------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| [Axis](#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1a42f19fcdd47c2b3c4131f3bf517c7607)`(int64 x)` | [Attrs](/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs) |\n| [NarrowRange](#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1a7948a2a783c7126aadc0a919fb2cb415)`(bool x)` | [Attrs](/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs) |\n| [NumBits](#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1a028ca64d10adcee074d4a035d04a87be)`(int64 x)` | [Attrs](/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs) |\n| [RangeGiven](#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1a7309d808ec9f47ae828e02f088915d14)`(bool x)` | [Attrs](/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs) |\n| [RoundMode](#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1a7017bf1bd8c367a9db4e516c8593a94c)`(StringPiece x)` | [Attrs](/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs) |\n| [SignedInput](#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1aa3c14ff4d3c6f20bcb9cf7b33fa28286)`(bool x)` | [Attrs](/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs) |\n\n| ### Structs ||\n|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::QuantizeAndDequantizeV4::Attrs](/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs) | Optional attribute setters for [QuantizeAndDequantizeV4](/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### QuantizeAndDequantizeV4\n\n```gdscript\n QuantizeAndDequantizeV4(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input input_min,\n ::tensorflow::Input input_max\n)\n``` \n\n### QuantizeAndDequantizeV4\n\n```gdscript\n QuantizeAndDequantizeV4(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input input_min,\n ::tensorflow::Input input_max,\n const QuantizeAndDequantizeV4::Attrs & attrs\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n``` \n\nPublic static functions\n-----------------------\n\n### Axis\n\n```text\nAttrs Axis(\n int64 x\n)\n``` \n\n### NarrowRange\n\n```text\nAttrs NarrowRange(\n bool x\n)\n``` \n\n### NumBits\n\n```text\nAttrs NumBits(\n int64 x\n)\n``` \n\n### RangeGiven\n\n```text\nAttrs RangeGiven(\n bool x\n)\n``` \n\n### RoundMode\n\n```text\nAttrs RoundMode(\n StringPiece x\n)\n``` \n\n### SignedInput\n\n```text\nAttrs SignedInput(\n bool x\n)\n```"]]