| Known Direct Subclasses |
Normalizes a TensorBuffer with given mean and stddev: output = (input - mean) / stddev.
Public Constructors
|
NormalizeOp(float mean, float stddev)
Initializes a NormalizeOp.
|
|
|
NormalizeOp(float[] mean, float[] stddev)
Initializes a NormalizeOp.
|
Public Methods
| TensorBuffer |
Inherited Methods
Public Constructors
public NormalizeOp (float mean, float stddev)
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.
1. Both mean and {code stddev} are 0.
2. 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.
Parameters
| mean | the mean value to be subtracted first. |
|---|---|
| stddev | the standard deviation value to divide then. |
Throws
| IllegalArgumentException | if stddev is zero.
|
|---|
public NormalizeOp (float[] mean, float[] stddev)
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.
Parameters
| mean | the mean values to be subtracted first for each channel. |
|---|---|
| stddev | the standard deviation values to divide then for each channel. |
Throws
| IllegalArgumentException | if any stddev is zero, or mean has different
number of elements with stddev, or any of them is empty.
|
|---|
Public Methods
public TensorBuffer apply (TensorBuffer input)
Applies the defined normalization on given tensor and returns the result.
Note: input is possibly the same instance with the output.
Parameters
| input | input tensor. It may be the same instance with the output. |
|---|
Returns
- output tensor.