f9aea094643fb3240193b0bc0f1908d5b84d82ab,dask_image/ndmeasure/__init__.py,,center_of_mass,#Any#Any#Any#,24

Before Change


    input_mtch_sum = sum(input, labels, index)

    input_wt_mtch_sum = []
    for i in _pycompat.irange(input.ndim):
        sl = input.ndim * [None]
        sl[i] = slice(None)
        sl = tuple(sl)

        input_i = dask.array.arange(input.shape[i], chunks=input.chunks[i])
        input_wt = input * input_i[sl]

        input_wt_mtch_sum.append(sum(input_wt, labels, index))

    input_wt_mtch_sum = dask.array.stack(input_wt_mtch_sum, axis=-1)

    com_lbl = input_wt_mtch_sum / input_mtch_sum[..., None]

After Change



    default_1d = numpy.full((1,), numpy.nan, dtype=out_dtype)

    func = functools.partial(
        _utils._center_of_mass, shape=input.shape, dtype=out_dtype
    )
    com_lbl = labeled_comprehension(
        input, labels, index,
        func, out_dtype, default_1d[0], pass_positions=True
    )
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: dask/dask-image
Commit Name: f9aea094643fb3240193b0bc0f1908d5b84d82ab
Time: 2018-09-30
Author: jakirkham@gmail.com
File Name: dask_image/ndmeasure/__init__.py
Class Name:
Method Name: center_of_mass


Project Name: datascienceinc/Skater
Commit Name: 9e622f5cf778243920741f87bae4d49111cf33d5
Time: 2017-03-27
Author: pramitchoudhary@ip-172-30-0-2.us-west-2.compute.internal
File Name: pyinterpret/core/global_interpretation/partial_dependence.py
Class Name: PartialDependence
Method Name: partial_dependence


Project Name: pytorch/fairseq
Commit Name: cfbf0dddbc2f06b4d2975655a3959d13e5ba6667
Time: 2021-01-21
Author: myleott@fb.com
File Name: tests/test_bmuf.py
Class Name: TestBMUF
Method Name: bmuf_process