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

Method __array__

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

computeMethod · 0.95

Tested by

no test coverage detected