tensorflow/lite/g3doc/api_docs/java/org/tensorflow/lite/support/common/ops/NormalizeOp.html
public class NormalizeOp
| Known Direct Subclasses
| DequantizeOp | Dequantizes a TensorBuffer with given zeroPoint and scale. |
| QuantizeOp | Quantizes a TensorBuffer with given zeroPoint and scale. |
|
Normalizes a TensorBuffer with given mean and stddev: output = (input - mean) / stddev.
| | NormalizeOp(float mean, float stddev) Initializes a NormalizeOp.
| | | NormalizeOp(float[] mean, float[] stddev) Initializes a NormalizeOp.
|
| TensorBuffer | apply(TensorBuffer input) Applies the defined normalization on given tensor and returns the result.
|
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.lite.support.common.TensorOperator
| abstract TensorBuffer | apply(TensorBuffer input) |
From interface org.tensorflow.lite.support.common.Operator
| abstract TensorBuffer | apply(TensorBuffer x) Applies an operation on a T object, returning a T object.
|
Initializes a NormalizeOp. When being called, it creates a new TensorBuffer, which satisfies:
output = (input - mean) / stddev
In the following two cases, reset mean to 0 and stddev to 1 to bypass the normalization.
mean and {code stddev} are 0.mean is 0 and {stddev} is Infinity.Note: If mean is set to 0 and stddev is set to 1, no computation will happen, and original input will be directly returned in execution.
Note: The returned TensorBuffer is always a DataType.FLOAT32 tensor at present, except when the input is a DataType.UINT8 tensor, mean is set to 0 and stddev is set to 1, so that the original DataType.UINT8 tensor is returned.
| mean | the mean value to be subtracted first. | | stddev | the standard deviation value to divide then. |
| IllegalArgumentException | if stddev is zero. |
Initializes a NormalizeOp. When being called, it creates a new TensorBuffer, which satisfies:
// Pseudo code. [...][i] means a certain element whose channel id is i.
output[...][i] = (input[...][i] - mean[i]) / stddev[i]
Note: If all values in mean are set to 0 and all stddev are set to 1, no computation will happen, and original input will be directly returned in execution.
Note: The returned TensorBuffer is always a DataType.FLOAT32 tensor at present, except that the input is a DataType.UINT8 tensor, all mean are set to 0 and all stddev are set to 1.
| mean | the mean values to be subtracted first for each channel. | | stddev | the standard deviation values to divide then for each channel. |
| IllegalArgumentException | if any stddev is zero, or mean has different number of elements with stddev, or any of them is empty. |
Applies the defined normalization on given tensor and returns the result.
Note: input is possibly the same instance with the output.
| input | input tensor. It may be the same instance with the output. |