MCPcopy Index your code
hub / github.com/numpy/numpy / _wrapreduction

Function _wrapreduction

numpy/_core/fromnumeric.py:66–83  ·  view source on GitHub ↗
(obj, ufunc, method, axis, dtype, out, **kwargs)

Source from the content-addressed store, hash-verified

64
65
66def _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs):
67 passkwargs = {k: v for k, v in kwargs.items()
68 if v is not np._NoValue}
69
70 if type(obj) is not mu.ndarray:
71 try:
72 reduction = getattr(obj, method)
73 except AttributeError:
74 pass
75 else:
76 # This branch is needed for reductions like any which don't
77 # support a dtype.
78 if dtype is not None:
79 return reduction(axis=axis, dtype=dtype, out=out, **passkwargs)
80 else:
81 return reduction(axis=axis, out=out, **passkwargs)
82
83 return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
84
85
86def _wrapreduction_any_all(obj, ufunc, method, axis, out, **kwargs):

Callers 6

sumFunction · 0.85
maxFunction · 0.85
amaxFunction · 0.85
minFunction · 0.85
aminFunction · 0.85
prodFunction · 0.85

Calls 2

itemsMethod · 0.80
reduceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…