| 1704 | __array_priority__ = 11 # higher than numpy.ndarray and numpy.matrix |
| 1705 | |
| 1706 | def __array__(self, dtype=None, copy=None, **kwargs): |
| 1707 | if kwargs: |
| 1708 | warnings.warn( |
| 1709 | f"Extra keyword arguments {kwargs} are ignored and won't be " |
| 1710 | "accepted in the future", |
| 1711 | FutureWarning, |
| 1712 | ) |
| 1713 | if copy is False: |
| 1714 | warnings.warn( |
| 1715 | "Can't acquire a memory view of a Dask array. " |
| 1716 | "This will raise in the future.", |
| 1717 | FutureWarning, |
| 1718 | ) |
| 1719 | |
| 1720 | x = self.compute() |
| 1721 | |
| 1722 | # Apply requested dtype and convert non-numpy backends to numpy. |
| 1723 | # If copy is True, numpy is going to perform its own deep copy |
| 1724 | # after this method returns. |
| 1725 | # If copy is None, finalize() ensures that the returned object |
| 1726 | # does not share memory with an object stored in the graph or on a |
| 1727 | # process-local Worker. |
| 1728 | return np.asarray(x, dtype=dtype) |
| 1729 | |
| 1730 | def __array_function__(self, func, types, args, kwargs): |
| 1731 | import dask.array as module |