# tensorflow::ops::FakeQuantWithMinMaxVarsPerChannel Class Reference

# tensorflow::
ops::
FakeQuantWithMinMaxVarsPerChannel

`
#include <array_ops.h>
`


Fake-quantize the 'inputs' tensor of type float via per-channel floats.

## Summary


Fake-quantize the
`
inputs
`
tensor of type float per-channel and one of the shapes:
`
[d]
`
,
`
[b, d]
`
`
[b, h, w, d]
`
via per-channel floats
`
min
`
and
`
max
`
of shape
`
[d]
`
to
`
outputs
`
tensor of same shape as
`
inputs
`
.


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.

<br />


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
  ` .

<br />


This operation has a gradient and thus allows for training
`
min
`
and
`
max
`
values.


Args:

- scope: A [Scope](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object

<br />


Returns:

- `
  https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output
  ` : The outputs tensor.

<br />

| ### Constructors and Destructors ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fake-quant-with-min-max-vars-per-channel#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_vars_per_channel_1a6030177a230ce0707cc84d79780582a9 (const :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input inputs, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input min, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input max) ` ||
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fake-quant-with-min-max-vars-per-channel#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_vars_per_channel_1a757ed99cef8d6918b36881c63b277e37 (const :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input inputs, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input min, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input max, const https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/fake-quant-with-min-max-vars-per-channel/attrs#structtensorflow_1_1ops_1_1_fake_quant_with_min_max_vars_per_channel_1_1_attrs & attrs) ` ||

| ### Public attributes ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fake-quant-with-min-max-vars-per-channel#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_vars_per_channel_1aa47fa159b050ba6248ed92fab3b37c71 ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fake-quant-with-min-max-vars-per-channel#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_vars_per_channel_1a045da04027810b223dfcd856f1a5aeb6 ` | ` :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output ` |

| ### Public functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fake-quant-with-min-max-vars-per-channel#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_vars_per_channel_1a8b5095141e6cd70ed955461ded03fed9 () const ` | ` ::tensorflow::Node * ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fake-quant-with-min-max-vars-per-channel#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_vars_per_channel_1ac20c09de7bf22ed92c3c4e8779c91731 () const ` | ` ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fake-quant-with-min-max-vars-per-channel#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_vars_per_channel_1a1e190c4077dd2fc0e08d472ac85d044e () const ` | ` ` |

| ### Public static functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fake-quant-with-min-max-vars-per-channel#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_vars_per_channel_1a8988bcb74e45c0d5741dc23d48ff4218 (bool x) ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/fake-quant-with-min-max-vars-per-channel/attrs#structtensorflow_1_1ops_1_1_fake_quant_with_min_max_vars_per_channel_1_1_attrs ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fake-quant-with-min-max-vars-per-channel#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_vars_per_channel_1a8e692f7bad00eea0472c6e277b38ca89 (int64 x) ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/fake-quant-with-min-max-vars-per-channel/attrs#structtensorflow_1_1ops_1_1_fake_quant_with_min_max_vars_per_channel_1_1_attrs ` |

| ### Structs ||
|---|---|
| [tensorflow:: ops:: FakeQuantWithMinMaxVarsPerChannel:: Attrs](https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/fake-quant-with-min-max-vars-per-channel/attrs) | Optional attribute setters for [FakeQuantWithMinMaxVarsPerChannel](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/fake-quant-with-min-max-vars-per-channel#classtensorflow_1_1ops_1_1_fake_quant_with_min_max_vars_per_channel) . |

## Public attributes

### operation

```
Operation operation
```

### outputs

```
::tensorflow::Output outputs
```

## Public functions

### FakeQuantWithMinMaxVarsPerChannel

```
 FakeQuantWithMinMaxVarsPerChannel(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input inputs,
  ::tensorflow::Input min,
  ::tensorflow::Input max
)
```

### FakeQuantWithMinMaxVarsPerChannel

```
 FakeQuantWithMinMaxVarsPerChannel(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input inputs,
  ::tensorflow::Input min,
  ::tensorflow::Input max,
  const FakeQuantWithMinMaxVarsPerChannel::Attrs & attrs
)
```

### node

```
::tensorflow::Node * node() const 
```

### operator::tensorflow::Input

```
 operator::tensorflow::Input() const 
```

### operator::tensorflow::Output

```
 operator::tensorflow::Output() const 
```

## Public static functions

### NarrowRange

```
Attrs NarrowRange(
  bool x
)
```

### NumBits

```
Attrs NumBits(
  int64 x
)
```