MCPcopy Create free account
hub / github.com/numpy/numpy / _wrapreduction

Function _wrapreduction

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

Source from the content-addressed store, hash-verified

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

Callers 8

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

Calls 1

reduceMethod · 0.45

Tested by

no test coverage detected