# UniformRequantize

public final class **UniformRequantize** Given quantized tensor \`input\`, requantize it with new quantization parameters.


Given quantized tensor \`input\`, which was quantized using {input_scales, input_zero_points, input_quantization_axis, input_quantization_min_val, input_quantization_max_val},
requantize it to a tensor, which is quantized using {output_scales, output_zero_points, output_quantization_axis, output_quantization_min_val, output_quantization_max_val}.
The requantization is done by using the formula:
output_quantized_data = clip(
(input_quantized_data - input_zero_point) \* (input_scale / output_scale) + output_zero_point,
output_quantization_min_val,
output_quantization_max_val)


Per-tensor and per-axis quantization supported cases are followings:

- per-tensor -\> per-tensor
- per-tensor -\> per-axis
- per-axis -\> per-axis where input_quantization_axis equals output_quantization_axis. i.e. At least one among input_quantization_axis and output_quantization_axis must be -1, or two must be equal.

<br />

<br />

<br />

### Nested Classes

|---|---|---|---|
| class | [UniformRequantize.Options](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize.Options) || Optional attributes for `https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize` |

### Public Methods

|---|---|
| [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<U\> | [asOutput](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize#asOutput())() Returns the symbolic handle of a tensor. |
| static \<U, T\> [UniformRequantize](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize)\<U\> | [create](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize#create(org.tensorflow.op.Scope,%20org.tensorflow.Operand<T>,%20org.tensorflow.Operand<java.lang.Float>,%20org.tensorflow.Operand<java.lang.Integer>,%20org.tensorflow.Operand<java.lang.Float>,%20org.tensorflow.Operand<java.lang.Integer>,%20java.lang.Class<U>,%20java.lang.Long,%20java.lang.Long,%20java.lang.Long,%20java.lang.Long,%20org.tensorflow.op.core.UniformRequantize.Options...))([Scope](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<T\> input, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<Float\> inputScales, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<Integer\> inputZeroPoints, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<Float\> outputScales, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<Integer\> outputZeroPoints, Class\<U\> Tout, Long inputQuantizationMinVal, Long inputQuantizationMaxVal, Long outputQuantizationMinVal, Long outputQuantizationMaxVal, [Options...](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize.Options) options) Factory method to create a class wrapping a new UniformRequantize operation. |
| static [UniformRequantize.Options](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize.Options) | [inputQuantizationAxis](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize#inputQuantizationAxis(java.lang.Long))(Long inputQuantizationAxis) |
| [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<U\> | [output](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize#output())() The output quantized Tensor of Tout, whose shape is same as input. |
| static [UniformRequantize.Options](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize.Options) | [outputQuantizationAxis](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize#outputQuantizationAxis(java.lang.Long))(Long outputQuantizationAxis) |

### Inherited Methods

From class [org.tensorflow.op.PrimitiveOp](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp)

|---|---|
| final boolean | [equals](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp#equals(java.lang.Object))(Object obj) |
| final int | [hashCode](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp#hashCode())() |
| [Operation](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operation) | [op](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp#op())() Returns the underlying `https://www.tensorflow.org/api_docs/java/org/tensorflow/Operation` |
| final String | [toString](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/PrimitiveOp#toString())() |

From class java.lang.Object

|---|---|
| boolean | equals(Object arg0) |
| final Class\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| String | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

From interface [org.tensorflow.Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)

|---|---|
| abstract [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<U\> | [asOutput](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand#asOutput())() Returns the symbolic handle of a tensor. |

## Public Methods

#### public [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<U\>
**asOutput**
()

Returns the symbolic handle of a tensor.

Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is
used to obtain a symbolic handle that represents the computation of the input.

<br />

#### public static [UniformRequantize](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize)\<U\>
**create**
([Scope](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/Scope) scope, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<T\> input, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<Float\> inputScales, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<Integer\> inputZeroPoints, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<Float\> outputScales, [Operand](https://www.tensorflow.org/api_docs/java/org/tensorflow/Operand)\<Integer\> outputZeroPoints, Class\<U\> Tout, Long inputQuantizationMinVal, Long inputQuantizationMaxVal, Long outputQuantizationMinVal, Long outputQuantizationMaxVal, [Options...](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize.Options) options)

Factory method to create a class wrapping a new UniformRequantize operation.

##### Parameters

| scope | current scope |
| input | Must be a Tensor of Tin. |
| inputScales | The float value(s) used as scale(s) when quantizing original data that \`input\` represents. Must be a scalar Tensor if quantization_axis is -1 (per-tensor quantization), otherwise 1D Tensor of size (input.dim_size(quantization_axis),) (per-axis quantization). |
| inputZeroPoints | The int32 value(s) used as zero_point(s) when quantizing original data that \`input\` represents. Same shape condition as scales. |
| outputScales | The float value(s) to use as new scale(s) to quantize original data that \`input\` represents. Must be a scalar Tensor if quantization_axis is -1 (per-tensor quantization), otherwise 1D Tensor of size (input.dim_size(quantization_axis),) (per-axis quantization). |
| outputZeroPoints | The int32 value(s) to use as new zero_point(s) to quantize original data that \`input\` represents. Same shape condition as scales. |
| Tout | The type of output Tensor. A tf.DType from: tf.qint8, tf.qint32 |
| inputQuantizationMinVal | The quantization min value that was used when quantizing original data that \`input\` represents. The purpose of this attribute is typically (but not limited to) to indicate narrow range, where this is set to: \`(Tin lowest) + 1\` if narrow range, and \`(Tin lowest)\` otherwise. For example, if Tin is qint8, this is set to -127 if narrow range quantized or -128 if not. |
| inputQuantizationMaxVal | The quantization max value that was used when quantizing original data that \`input\` represents. The purpose of this attribute is typically (but not limited to) indicate narrow range, where this is set to: \`(Tout max)\` for both narrow range and not narrow range. For example, if Tin is qint8, this is set to 127. |
| outputQuantizationMinVal | The new quantization min value to quantize original data that \`input\` represents. |
| outputQuantizationMaxVal | The new quantization max value to quantize original data that \`input\` represents. |
| options | carries optional attributes values |
|---|---|

##### Returns

- a new instance of UniformRequantize

#### public static [UniformRequantize.Options](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize.Options)
**inputQuantizationAxis**
(Long inputQuantizationAxis)

<br />

##### Parameters

| inputQuantizationAxis | The quantization axis that was used when quantizing original data that \`input\` represents. Indicates the dimension index of the tensor where per-axis quantization is applied for the slices along that dimension. If set to -1 (default), this indicates per-tensor quantization. Otherwise, it must be set within range \[0, input.dims()). |
|---|---|

#### public [Output](https://www.tensorflow.org/api_docs/java/org/tensorflow/Output)\<U\>
**output**
()

The output quantized Tensor of Tout, whose shape is same as input.

#### public static [UniformRequantize.Options](https://www.tensorflow.org/api_docs/java/org/tensorflow/op/core/UniformRequantize.Options)
**outputQuantizationAxis**
(Long outputQuantizationAxis)

<br />

##### Parameters

| outputQuantizationAxis | The new quantization axis to use to quantize original data that \`input\` represents. |
|---|---|