Consider the following code:
import numpy as np
A = np.array([[.8, .6], [.1, 0]])
B1 = tf.keras.utils.normalize(A, axis=0, order=1)
B2 = tf.keras.utils.normalize(A, axis=0, order=2)
print('A:')
print(A)
print('B1:')
print(B1)
print('B2:')
print(B2)
which returns
A:
[[0.8 0.6]
[0.1 0. ]]
B1:
[[0.88888889 1. ]
[0.11111111 0. ]]
B2:
[[0.99227788 1. ]
[0.12403473 0. ]]
I understand how B1
is computed via order=1
such that each entry in A
is divided by the sum of the elements in its column. For example, 0.8
becomes 0.8/(0.8+0.1) = 0.888
. However, I just can't figure out how order=2
produces B2
nor can I find any documentation about it.