tf.keras.ops.normalize
Stay organized with collections
Save and categorize content based on your preferences.
Normalizes x
over the specified axis.
tf.keras.ops.normalize(
x, axis=-1, order=2
)
It is defined as: normalize(x) = x / max(norm(x), epsilon)
.
Args |
x
|
Input tensor.
|
axis
|
The axis or axes along which to perform normalization.
Default to -1.
|
order
|
The exponent value in the norm formulation.
Defaults to 2.
|
Returns |
The normalized array.
|
Example:
x = keras.ops.convert_to_tensor([[1, 2, 3], [4, 5, 6]])
x_norm = keras.ops.math.normalize(x)
print(x_norm)
array([[0.26726124 0.5345225 0.8017837 ]
[0.45584232 0.5698029 0.68376344]], shape=(2, 3), dtype=float32)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-06-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-07 UTC."],[],[]]