| 64 | |
| 65 | |
| 66 | def _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 | |
| 86 | def _wrapreduction_any_all(obj, ufunc, method, axis, out, **kwargs): |