8daace20a97c65f845ed008f4b60bdc62b12e250,gensim/matutils.py,,unitvec,#Any#Any#Any#,669

Before Change


                return vec

    if isinstance(vec, np.ndarray):
        vec = np.asarray(vec, dtype=float)
        if norm == "l1":
            veclen = np.sum(np.abs(vec))
        if norm == "l2":
            veclen = blas_nrm2(vec)

After Change


        if norm == "l2":
            veclen = blas_nrm2(vec)
        if veclen > 0.0:
            if np.issubdtype(vec.dtype, np.int):
                vec = vec.astype(np.float)
            if return_norm:
                return blas_scal(1.0 / veclen, vec).astype(vec.dtype), veclen
            else:
                return blas_scal(1.0 / veclen, vec).astype(vec.dtype)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: RaRe-Technologies/gensim
Commit Name: 8daace20a97c65f845ed008f4b60bdc62b12e250
Time: 2018-04-15
Author: 35378674+o-P-o@users.noreply.github.com
File Name: gensim/matutils.py
Class Name:
Method Name: unitvec


Project Name: scipy/scipy
Commit Name: ae151484780b389b5c7b4530c9ac1ef4bb659e23
Time: 2020-01-13
Author: rlucas7@users.noreply.github.com
File Name: scipy/special/_basic.py
Class Name:
Method Name: factorial


Project Name: sentinel-hub/eo-learn
Commit Name: 889cde4a62dbcedbb5856ed3b295b742031074ac
Time: 2019-10-11
Author: jovan.visnjic@sinergise.com
File Name: io/eolearn/io/processing_api.py
Class Name: Sentinelhub16bitInput
Method Name: execute