(vec)
return vec
Normalize the vector(s) *vec* (in-place if it is a ndarray).

    Parameters
    ----------
    vec : float, array-like of shape (D,) or (D, N)
      The D-vector(s) to normalize.

    Returns
    -------
    vec_normed : float, array
      Normalized vec, shape (D,) or (D, N)
Normalize the vector(s) *vec* (in-place if it is a ndarray).
Normalize the vector ( s ) * vec * ( in - place if it is a ndarray ) .
def normalize_vec(vec):
    """Normalize the vector(s) *vec* (in-place if it is a ndarray).

    Parameters
    ----------
    vec : float, array-like of shape (D,) or (D, N)
      The D-vector(s) to normalize.

    Returns
    -------
    vec_normed : float, array
      Normalized vec, shape (D,) or (D, N)
    """
    vec = np.array(vec, np.float64)
    r = np.sqrt(np.sum(vec ** 2, axis=0))
    vec /= r
    return vec
def normalize_vec ( vec ) : vec = np . array ( vec , np . float64 ) r = np . sqrt ( np . sum ( vec ** 2 , axis = 0 ) ) vec /= r return vec