-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
I understand map_blocks can work for function which returns scalar as below.
import numpy as np
import dask.array as da
darr = da.from_array(np.array([1, 2, 3, 4]), chunks=2)
def f(x):
return 1
darr.map_blocks(f).compute()
# array([1, 1])
However, it may raises IndexError in ufuncs, which returns 0-dim array. Should it be handled like scalar, or raise understandable error message?
darr.map_blocks(np.sum).compute()
# IndexError: tuple index out of range
def h(x):
return np.array(1)
darr.map_blocks(h).compute()
# IndexError: tuple index out of range
# Specifying chunks doesn't solve the problem
darr.map_blocks(h, chunks=(1, )).compute()
# IndexError: tuple index out of range
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels