f9aea094643fb3240193b0bc0f1908d5b84d82ab,dask_image/ndmeasure/__init__.py,,center_of_mass,#,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
// This only matters if index is some array.
index = index.T
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(
_utils._center_of_mass, shape=input.shape, dtype=out_dtype
)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 11
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: neubig/nn4nlp-code
Commit Name: f33f453e5c7f39f7f0eeb863ba7d786f58ae41b3
Time: 2017-11-26
Author: neubig@gmail.com
File Name: 07-sentrep/text-retrieval.py
Class Name:
Method Name: index_corpus
Project Name: vitchyr/rlkit
Commit Name: 9bdbb11cf27060e7847a87dcdf691dd6b96ce6df
Time: 2020-08-09
Author: 38036768+YangRui2015@users.noreply.github.com
File Name: rlkit/data_management/obs_dict_replay_buffer.py
Class Name: ObsDictRelabelingBuffer
Method Name: random_batch