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