# tensorflow::ops::QuantizeAndDequantizeV4

`#include <array_ops.h>`

Quantizes then dequantizes a tensor.

## Summary

This is almost identical to [QuantizeAndDequantizeV2](https://www.tensorflow.org/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.

Args:

- scope: A [Scope](https://www.tensorflow.org/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object
- input: [Tensor](https://www.tensorflow.org/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_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.

<br />

Optional attributes (see `https://www.tensorflow.org/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_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.

<br />

Returns:

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

<br />

| ### Constructors and Destructors ||
|---|---|
| `https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1adf55b9a7b0c3fa2453f41c8dbf1a5efe(const ::https://www.tensorflow.org/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, ::https://www.tensorflow.org/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input input, ::https://www.tensorflow.org/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input input_min, ::https://www.tensorflow.org/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input input_max)` ||
| `https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1ad468066168d14743d1848d5071f8ae62(const ::https://www.tensorflow.org/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, ::https://www.tensorflow.org/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input input, ::https://www.tensorflow.org/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input input_min, ::https://www.tensorflow.org/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input input_max, const https://www.tensorflow.org/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs & attrs)` ||

| ### Public attributes ||
|---|---|
| `https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1acc1392aae55ad8bb0568d36a666ae25c` | `https://www.tensorflow.org/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation` |
| `https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1a7262a1066f9e9739306a7ab4708f7565` | `::https://www.tensorflow.org/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` |

| ### Public functions ||
|---|---|
| `https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1af8b0df43395454f3df89a8c20a4c3d60() const ` | `::tensorflow::Node *` |
| `https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1ac4a46ea522efb956a6b595c85d366c13() const ` |   |
| `https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1a181936ef24e93066a7e9f65bcf9a4aa3() const ` |   |

| ### Public static functions ||
|---|---|
| `https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1a42f19fcdd47c2b3c4131f3bf517c7607(int64 x)` | `https://www.tensorflow.org/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs` |
| `https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1a7948a2a783c7126aadc0a919fb2cb415(bool x)` | `https://www.tensorflow.org/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs` |
| `https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1a028ca64d10adcee074d4a035d04a87be(int64 x)` | `https://www.tensorflow.org/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs` |
| `https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1a7309d808ec9f47ae828e02f088915d14(bool x)` | `https://www.tensorflow.org/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs` |
| `https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1a7017bf1bd8c367a9db4e516c8593a94c(StringPiece x)` | `https://www.tensorflow.org/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs` |
| `https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1aa3c14ff4d3c6f20bcb9cf7b33fa28286(bool x)` | `https://www.tensorflow.org/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs#structtensorflow_1_1ops_1_1_quantize_and_dequantize_v4_1_1_attrs` |

| ### Structs ||
|---|---|
| [tensorflow::ops::QuantizeAndDequantizeV4::Attrs](https://www.tensorflow.org/api_docs/cc/struct/tensorflow/ops/quantize-and-dequantize-v4/attrs) | Optional attribute setters for [QuantizeAndDequantizeV4](https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/quantize-and-dequantize-v4#classtensorflow_1_1ops_1_1_quantize_and_dequantize_v4). |

## 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
)
```