MCPcopy Create free account
hub / github.com/dask/dask / __array__

Method __array__

dask/array/core.py:1704–1726  ·  view source on GitHub ↗
(self, dtype=None, copy=None, **kwargs)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

computeMethod · 0.95

Tested by

no test coverage detected