(self, numpy_ufunc, method, *inputs, **kwargs)
| 625 | return clip(self, min, max) |
| 626 | |
| 627 | def __array_ufunc__(self, numpy_ufunc, method, *inputs, **kwargs): |
| 628 | out = kwargs.get("out", ()) |
| 629 | for x in inputs + out: |
| 630 | if _should_delegate(self, x): |
| 631 | return NotImplemented |
| 632 | |
| 633 | if method == "__call__": |
| 634 | if numpy_ufunc is np.matmul: |
| 635 | from dask.array.routines import matmul |
| 636 | |
| 637 | # special case until apply_gufunc handles optional dimensions |
| 638 | return matmul(*inputs, **kwargs) |
| 639 | if numpy_ufunc.signature is not None: |
| 640 | from dask.array._array_expr._gufunc import apply_gufunc |
| 641 | |
| 642 | return apply_gufunc( |
| 643 | numpy_ufunc, numpy_ufunc.signature, *inputs, **kwargs |
| 644 | ) |
| 645 | if numpy_ufunc.nout > 1: |
| 646 | from dask.array._array_expr import _ufunc as ufunc |
| 647 | |
| 648 | try: |
| 649 | da_ufunc = getattr(ufunc, numpy_ufunc.__name__) |
| 650 | except AttributeError: |
| 651 | return NotImplemented |
| 652 | return da_ufunc(*inputs, **kwargs) |
| 653 | else: |
| 654 | return elemwise(numpy_ufunc, *inputs, **kwargs) |
| 655 | elif method == "outer": |
| 656 | from dask.array._array_expr import _ufunc as ufunc |
| 657 | |
| 658 | try: |
| 659 | da_ufunc = getattr(ufunc, numpy_ufunc.__name__) |
| 660 | except AttributeError: |
| 661 | return NotImplemented |
| 662 | return da_ufunc.outer(*inputs, **kwargs) |
| 663 | else: |
| 664 | return NotImplemented |
| 665 | |
| 666 | def map_overlap(self, func, depth, boundary=None, trim=True, **kwargs): |
| 667 | """Map a function over blocks of the array with some overlap |
nothing calls this directly
no test coverage detected