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=1and \(\mathbf{x}\) is a matrix of dimension \((N, K)\), where \(N\) and \(K\) denote mini-batch size and the dimension of the input vectors, this function computes an output matrix \(\mathbf{y}\) of dimension \((N, K)\) by the following equation:\[\mathbf{y}_i = {\mathbf{x}_i \over \| \mathbf{x}_i \|_2 + \epsilon}\]- epsis used to avoid division by zero when norm of \(\mathbf{x}\) along the given axis is zero.- The default value of - axisis determined for backward compatibility.- Parameters
- x ( - Variableor N-dimensional array) – Two dimensional output variable. The first dimension is assumed to be the mini-batch dimension.
- eps (float) – Epsilon value for numerical stability. 
- axis (int or tuple of ints) – Axis along which to normalize. 
 
- Returns
- The output variable which has the same shape as \(x\). 
- Return type