MCPcopy
hub / github.com/dask/dask / fromfunction

Function fromfunction

dask/array/creation.py:844–857  ·  view source on GitHub ↗
(func, chunks="auto", shape=None, dtype=None, **kwargs)

Source from the content-addressed store, hash-verified

842
843@derived_from(np)
844def fromfunction(func, chunks="auto", shape=None, dtype=None, **kwargs):
845 dtype = dtype or float
846 chunks = normalize_chunks(chunks, shape, dtype=dtype)
847
848 inds = tuple(range(len(shape)))
849
850 arrs = [arange(s, dtype=dtype, chunks=c) for s, c in zip(shape, chunks)]
851 arrs = meshgrid(*arrs, indexing="ij")
852
853 args = sum(zip(arrs, itertools.repeat(inds)), ())
854
855 res = blockwise(func, inds, *args, token="fromfunction", **kwargs)
856
857 return res
858
859
860@derived_from(np)

Callers

nothing calls this directly

Calls 6

normalize_chunksFunction · 0.90
meshgridFunction · 0.85
repeatMethod · 0.80
arangeFunction · 0.70
sumFunction · 0.70
blockwiseFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…