View source on GitHub
|
Normalizes x by mean and variance.
tf.keras.ops.batch_normalization(
x, mean, variance, axis, offset=None, scale=None, epsilon=0.001
)
This op is typically used by the batch normalization step in a neural network. It normalizes the input tensor along the given axis.
Returns | |
|---|---|
| The normalized tensor. |
Example:
x = keras.ops.convert_to_tensor([[0.1, 0.2, 0.3], [0.4, 0.5, 0.6], [0.7, 0.8, 0.9]])keras.ops.batch_normalization(x,mean=[0.4, 0.5, 0.6],variance=[0.67, 0.67, 0.67],axis=-1)array([[-3.6624e-01, -3.6624e-01, -3.6624e-01],[-4.6445e-09, 0.0000e+00, -1.8578e-08],[ 3.6624e-01, 3.6624e-01, 3.6624e-01]])
View source on GitHub