(self, numpy_ufunc, method, *inputs, **kwargs)
| 1563 | return int(sum(self.chunks[0])) |
| 1564 | |
| 1565 | def __array_ufunc__(self, numpy_ufunc, method, *inputs, **kwargs): |
| 1566 | out = kwargs.get("out", ()) |
| 1567 | for x in inputs + out: |
| 1568 | if _should_delegate(self, x): |
| 1569 | return NotImplemented |
| 1570 | |
| 1571 | if method == "__call__": |
| 1572 | if numpy_ufunc is np.matmul: |
| 1573 | from dask.array.routines import matmul |
| 1574 | |
| 1575 | # special case until apply_gufunc handles optional dimensions |
| 1576 | return matmul(*inputs, **kwargs) |
| 1577 | if numpy_ufunc.signature is not None: |
| 1578 | from dask.array.gufunc import apply_gufunc |
| 1579 | |
| 1580 | return apply_gufunc( |
| 1581 | numpy_ufunc, numpy_ufunc.signature, *inputs, **kwargs |
| 1582 | ) |
| 1583 | if numpy_ufunc.nout > 1: |
| 1584 | from dask.array import ufunc |
| 1585 | |
| 1586 | try: |
| 1587 | da_ufunc = getattr(ufunc, numpy_ufunc.__name__) |
| 1588 | except AttributeError: |
| 1589 | return NotImplemented |
| 1590 | return da_ufunc(*inputs, **kwargs) |
| 1591 | else: |
| 1592 | return elemwise(numpy_ufunc, *inputs, **kwargs) |
| 1593 | elif method == "outer": |
| 1594 | from dask.array import ufunc |
| 1595 | |
| 1596 | try: |
| 1597 | da_ufunc = getattr(ufunc, numpy_ufunc.__name__) |
| 1598 | except AttributeError: |
| 1599 | return NotImplemented |
| 1600 | return da_ufunc.outer(*inputs, **kwargs) |
| 1601 | else: |
| 1602 | return NotImplemented |
| 1603 | |
| 1604 | def __repr__(self): |
| 1605 | """ |
nothing calls this directly
no test coverage detected