Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::
ops::
FakeQuantWithMinMaxArgs
#include <array_ops.h>
Fake-quantize the 'inputs' tensor, type float to 'outputs' tensor of same type.
Summary
Attributes
-
[min; max]
define the clamping range for the
inputs
data.
-
inputs
values are quantized into the quantization range (
[0; 2^num_bits - 1]
when
narrow_range
is false and
[1; 2^num_bits - 1]
when it is true) and then de-quantized and output as floats in
[min; max]
interval.
-
num_bits
is the bitwidth of the quantization; between 2 and 16, inclusive.
Before quantization,
min
and
max
values are adjusted with the following logic. It is suggested to have
min <= 0 <= max
. If
0
is not in the range of values, the behavior can be unexpected:
-
If
0 < min < max
:
min_adj = 0
and
max_adj = max - min
.
-
If
min < max < 0
:
min_adj = min - max
and
max_adj = 0
.
-
If
min <= 0 <= max
:
scale = (max - min) / (2^num_bits - 1)
,
min_adj = scale * round(min / scale)
and
max_adj = max + min_adj - min
.
Quantization is called fake since the output is still in floating point.
Args:
Returns:
Public attributes
Public functions
node
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Public static functions
NarrowRange
Attrs NarrowRange(
bool x
)
NumBits
Attrs NumBits(
int64 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-08-16 UTC.
[null,null,["Last updated 2021-08-16 UTC."],[],[],null,["# tensorflow::ops::FakeQuantWithMinMaxArgs Class Reference\n\ntensorflow::\nops::\nFakeQuantWithMinMaxArgs\n==========================================\n\n`\n#include \u003carray_ops.h\u003e\n`\n\n\nFake-quantize the 'inputs' tensor, type float to 'outputs' tensor of same type.\n\nSummary\n-------\n\n\nAttributes\n\n\n- `\n [min; max]\n ` define the clamping range for the `\n inputs\n ` data.\n- `\n inputs\n ` values are quantized into the quantization range ( `\n [0; 2^num_bits - 1]\n ` when `\n narrow_range\n ` is false and `\n [1; 2^num_bits - 1]\n ` when it is true) and then de-quantized and output as floats in `\n [min; max]\n ` interval.\n- `\n num_bits\n ` is the bitwidth of the quantization; between 2 and 16, inclusive.\n\n\u003cbr /\u003e\n\n\nBefore quantization,\n`\nmin\n`\nand\n`\nmax\n`\nvalues are adjusted with the following logic. It is suggested to have\n`\nmin \u003c= 0 \u003c= max\n`\n. If\n`\n0\n`\nis not in the range of values, the behavior can be unexpected:\n\n\n- If `\n 0 \u003c min \u003c max\n ` : `\n min_adj = 0\n ` and `\n max_adj = max - min\n ` .\n- If `\n min \u003c max \u003c 0\n ` : `\n min_adj = min - max\n ` and `\n max_adj = 0\n ` .\n- If `\n min \u003c= 0 \u003c= max\n ` : `\n scale = (max - min) / (2^num_bits - 1)\n ` , `\n min_adj = scale * round(min / scale)\n ` and `\n max_adj = max + min_adj - min\n ` .\n\n\u003cbr /\u003e\n\n\nQuantization is called fake since the output is still in floating point.\n\n\nArgs:\n\n- scope: A [Scope](/versions/r2.6/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n\n\u003cbr /\u003e\n\n\nReturns:\n\n- `\n `[Output](/versions/r2.6/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)`\n ` : The outputs tensor.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| ` `[FakeQuantWithMinMaxArgs](#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1a85e03d1dc3cd4bc32cd221b7b9cf6d9a)` (const :: `[tensorflow::Scope](/versions/r2.6/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, :: `[tensorflow::Input](/versions/r2.6/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` inputs) ` ||\n| ` `[FakeQuantWithMinMaxArgs](#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1a5a50c94e0d72103df198cd3f00bed13d)` (const :: `[tensorflow::Scope](/versions/r2.6/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, :: `[tensorflow::Input](/versions/r2.6/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` inputs, const `[FakeQuantWithMinMaxArgs::Attrs](/versions/r2.6/api_docs/cc/struct/tensorflow/ops/fake-quant-with-min-max-args/attrs#structtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1_1_attrs)` & attrs) ` ||\n\n| ### Public attributes ||\n|----------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|\n| ` `[operation](#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1a74ebb70c787d9ab49c7e4f6a25a1caba)` ` | ` `[Operation](/versions/r2.6/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation)` ` |\n| ` `[outputs](#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1a9f9cb032ade7705f0b4a03b0ab94cb0c)` ` | ` :: `[tensorflow::Output](/versions/r2.6/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)` ` |\n\n| ### Public functions ||\n|--------------------------------------------------------------------------------------------------------------------------------------------|--------------------------|\n| ` `[node](#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1adf0a81f8d2e49f0bf4eb5859fac39168)` () const ` | ` ::tensorflow::Node * ` |\n| ` `[operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1a51cf8e44b3b26ce30a5016a440b99c69)` () const ` | ` ` |\n| ` `[operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1a614548643c093eefd86990ce72baece3)` () const ` | ` ` |\n\n| ### Public static functions ||\n|---------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` `[Max](#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1a5e82983f6429be0078510aea65c1593b)` (float x) ` | ` `[Attrs](/versions/r2.6/api_docs/cc/struct/tensorflow/ops/fake-quant-with-min-max-args/attrs#structtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1_1_attrs)` ` |\n| ` `[Min](#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1a3fd5bd826632651830791d26c59fb56f)` (float x) ` | ` `[Attrs](/versions/r2.6/api_docs/cc/struct/tensorflow/ops/fake-quant-with-min-max-args/attrs#structtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1_1_attrs)` ` |\n| ` `[NarrowRange](#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1a9af5fd9211a71acf844cf8d911fde2ac)` (bool x) ` | ` `[Attrs](/versions/r2.6/api_docs/cc/struct/tensorflow/ops/fake-quant-with-min-max-args/attrs#structtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1_1_attrs)` ` |\n| ` `[NumBits](#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1a80f557e9c790845a7e5c910bae0ef5fd)` (int64 x) ` | ` `[Attrs](/versions/r2.6/api_docs/cc/struct/tensorflow/ops/fake-quant-with-min-max-args/attrs#structtensorflow_1_1ops_1_1_fake_quant_with_min_max_args_1_1_attrs)` ` |\n\n| ### Structs ||\n|-------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow:: ops:: FakeQuantWithMinMaxArgs:: Attrs](/versions/r2.6/api_docs/cc/struct/tensorflow/ops/fake-quant-with-min-max-args/attrs) | Optional attribute setters for [FakeQuantWithMinMaxArgs](/versions/r2.6/api_docs/cc/class/tensorflow/ops/fake-quant-with-min-max-args#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_args) . |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### outputs\n\n```text\n::tensorflow::Output outputs\n``` \n\nPublic functions\n----------------\n\n### FakeQuantWithMinMaxArgs\n\n```gdscript\n FakeQuantWithMinMaxArgs(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input inputs\n)\n``` \n\n### FakeQuantWithMinMaxArgs\n\n```gdscript\n FakeQuantWithMinMaxArgs(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input inputs,\n const FakeQuantWithMinMaxArgs::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### Max\n\n```text\nAttrs Max(\n float x\n)\n``` \n\n### Min\n\n```text\nAttrs Min(\n float 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```"]]