c9fd2c425cb873508ba16221819574400ad2443e,dask_image/ndmeasure/__init__.py,,extrema,#,75
Before Change
("max_val", input.dtype),
("max_pos", numpy.int)
])
default = numpy.zeros((), out_dtype)[()]
extrema_lbl = labeled_comprehension(
input, labels, index,
_utils._extrema, out_dtype, default, pass_positions=True
)
extrema_lbl = {k: extrema_lbl[k] for k in extrema_lbl.dtype.names}
for pos_key in ["min_pos", "max_pos"]:
pos_1d = extrema_lbl[pos_key]
if not pos_1d.ndim:
pos_1d = pos_1d[None]
pos_nd = _utils._unravel_index(pos_1d, input.shape)
if index.ndim == 0:
pos_nd = dask.array.squeeze(pos_nd)
elif index.ndim > 1:
pos_nd = pos_nd.reshape(
(int(numpy.prod(pos_nd.shape[:-1])), pos_nd.shape[-1])
)
extrema_lbl[pos_key] = pos_nd
result = (
extrema_lbl["min_val"],
extrema_lbl["max_val"],
extrema_lbl["min_pos"],
extrema_lbl["max_pos"]
)
return result
After Change
)
extrema_lbl = collections.OrderedDict([
(k, extrema_lbl[k]) for k in type_mapping.keys()
])
for pos_key in ["min_pos", "max_pos"]:
pos_1d = extrema_lbl[pos_key]
if not pos_1d.ndim:
pos_1d = pos_1d[None]
pos_nd = _utils._unravel_index(pos_1d, input.shape)
if index.ndim == 0:
pos_nd = dask.array.squeeze(pos_nd)
elif index.ndim > 1:
pos_nd = pos_nd.reshape(
(int(numpy.prod(pos_nd.shape[:-1])), pos_nd.shape[-1])
)
extrema_lbl[pos_key] = pos_nd
result = tuple(extrema_lbl.values())
return result
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: dask/dask-image
Commit Name: c9fd2c425cb873508ba16221819574400ad2443e
Time: 2018-09-30
Author: jakirkham@gmail.com
File Name: dask_image/ndmeasure/__init__.py
Class Name:
Method Name: extrema
Project Name: ANSSI-FR/SecuML
Commit Name: 39efccc696a1c20745a52cc50935cdc24f92230d
Time: 2019-05-09
Author: anael.beaugnon@ssi.gouv.fr
File Name: secuml/exp/data/features.py
Class Name: FeaturesFromExp
Method Name: get_matrix
Project Name: rtqichen/torchdiffeq
Commit Name: 7391aec984c1e9e0899d51e6b0538483c37ec8fb
Time: 2020-07-27
Author: 33688385+patrick-kidger@users.noreply.github.com
File Name: torchdiffeq/_impl/adjoint.py
Class Name:
Method Name: odeint_adjoint