dask 2021.10.0

BackRef
from_func(func, shape, dtype=None, name=None, args=(), kwargs={})

Calling the provided function with func(*args, **kwargs) should return a NumPy array of the indicated shape and dtype.

Create dask array in a single block by calling a function

Examples

This example is valid syntax, but we were not able to check execution
>>> a = from_func(np.arange, (3,), dtype='i8', args=(3,))
... a.compute() array([0, 1, 2])

This works particularly well when coupled with dask.array functions like concatenate and stack:

This example is valid syntax, but we were not able to check execution
>>> arrays = [from_func(np.array, (), dtype='i8', args=(n,)) for n in range(5)]
... stack(arrays).compute() array([0, 1, 2, 3, 4])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

dask.array.core.from_func

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /dask/array/core.py#3497
type: <class 'function'>
Commit: