chainer.functions.normalize¶
-
chainer.functions.
normalize
(x, eps=1e-05, axis=1)[source]¶ L2 norm squared (a.k.a. Euclidean norm).
This function implements L2 normalization on a vector along the given axis. No reduction is done along the normalization axis.
In the case when
axis=1
and \(x\) is a vector of dimension \((N, K)\), where \(N\) and \(K\) denote mini-batch size and the dimension of the input variable, this function computes an output vector \(y\) by the following equation:\[y_i = {x_i \over \| x_i \|_2 + \epsilon}\]eps
is used to avoid division by zero when norm of \(x\) along the given axis is zero.The default value of
axis
is determined for backward compatibility.Parameters: Returns: The output variable which has the same shape as \(x\).
Return type: