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