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

Method __array_ufunc__

dask/array/tests/test_dispatch.py:76–83  ·  view source on GitHub ↗
(self, ufunc, method, *inputs, **kwargs)

Source from the content-addressed store, hash-verified

74 __setitem__ = wrap("__setitem__")
75
76 def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
77 if not all(
78 isinstance(i, (type(self), np.ndarray) + np.ScalarType) for i in inputs
79 ):
80 return NotImplemented
81 inputs = tuple(i if not isinstance(i, type(self)) else i.arr for i in inputs)
82 a = getattr(ufunc, method)(*inputs, **kwargs)
83 return a if not isinstance(a, np.ndarray) else type(self)(a)
84
85 shape = dispatch_property("shape")
86 ndim = dispatch_property("ndim")

Callers

nothing calls this directly

Calls 1

allFunction · 0.85

Tested by

no test coverage detected