Skip to content

Commit

Permalink
Ensure that we use the dtype keyword in normalize_chunks (#4646)
Browse files Browse the repository at this point in the history
Fixes #4644
  • Loading branch information
mrocklin authored and jrbourbeau committed Mar 29, 2019
1 parent ec81d47 commit 7782cc4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dask/array/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def linspace(start, stop, num=50, endpoint=True, retstep=False, chunks='auto',
The number of samples on each block. Note that the last block will have
fewer samples if `num % blocksize != 0`
dtype : dtype, optional
The type of the output array. Default is given by ``numpy.dtype(float)``.
The type of the output array.
Returns
-------
Expand All @@ -216,16 +216,16 @@ def linspace(start, stop, num=50, endpoint=True, retstep=False, chunks='auto',
"""
num = int(num)

chunks = normalize_chunks(chunks, (num,))
if dtype is None:
dtype = np.linspace(0, 1, 1).dtype

chunks = normalize_chunks(chunks, (num,), dtype=dtype)

range_ = stop - start

div = (num - 1) if endpoint else num
step = float(range_) / div

if dtype is None:
dtype = np.linspace(0, 1, 1).dtype

name = 'linspace-' + tokenize((start, stop, num, endpoint, chunks, dtype))

dsk = {}
Expand Down Expand Up @@ -675,7 +675,7 @@ def offset_func(*args, **kwargs):

@wraps(np.fromfunction)
def fromfunction(func, chunks='auto', shape=None, dtype=None, **kwargs):
chunks = normalize_chunks(chunks, shape)
chunks = normalize_chunks(chunks, shape, dtype=dtype)
name = 'fromfunction-' + tokenize(func, chunks, shape, dtype, kwargs)
keys = list(product([name], *[range(len(bd)) for bd in chunks]))
aggdims = [list(accumulate(add, (0,) + bd[:-1])) for bd in chunks]
Expand Down

0 comments on commit 7782cc4

Please sign in to comment.