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

Before Change


    // This only matters if index is some array.
    index = index.T

    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]

    return com_lbl

After Change


    type_mapping = collections.OrderedDict([
        (("%i" % i), input.dtype) for i in _pycompat.irange(input.ndim)
    ])
    out_dtype = numpy.dtype(list(type_mapping.items()))

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

    func = functools.partial(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

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: senarvi/theanolm
Commit Name: 0189ed321c532d8b0ab19fe453487c1c477ff5f4
Time: 2017-06-03
Author: seppo.git@marjaniemi.com
File Name: theanolm/network/softmaxlayer.py
Class Name: SoftmaxLayer
Method Name: create_structure


Project Name: senarvi/theanolm
Commit Name: 6ceb5009421fc6acb3b9258bc70941b2eb15bc53
Time: 2015-10-03
Author: seppo.git@marjaniemi.com
File Name: theanolm/src/theanolm/trainers/modeltrainer.py
Class Name: ModelTrainer
Method Name: __init__