| 69 | |
| 70 | |
| 71 | def _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 | |
| 91 | def _take_dispatcher(a, indices, axis=None, out=None, mode=None): |