Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement dask.array.broadcast_to #108

Merged
merged 1 commit into from Mar 29, 2015
Merged

Conversation

shoyer
Copy link
Member

@shoyer shoyer commented Mar 29, 2015

No description provided.

% (x.shape, shape))

name = next(names)
blockdims = (tuple((s,) for s in shape[:ndim_new])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we always want solid, un-cut blocks in the new dimensions? Or maybe this is a case where we reblock afterwards.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about this to. Arguably, this function should take optional blockshape and blockdims arguments.

I do think (auto-)reblocking will cover most of that use case. In particular, there is never a concern about memory usage because the new, arbitrarily large chunks will always be broadcast versions of the original chunks.

One potential downside of separate reblocking is that it wouldn't be able to take advantage of the fact that many of the chunks would be redundant. So that would entail somewhat more overhead, both for the scheduler and for slicing the broadcast expanded dimensions with numpy.

I'll make a follow-up issue.

@mrocklin
Copy link
Member

Seeing other people implement dask functions gives me a very warm feeling inside.

x = np.random.randint(10, size=(5, 1, 6))
a = from_array(x, blockshape=(3, 1, 3))

for shape in [(5, 4, 6), (2, 5, 1, 6), (3, 4, 5, 4, 6)]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing these shapes helped me to understand the scope of broadcast_to

mrocklin added a commit that referenced this pull request Mar 29, 2015
Implement dask.array.broadcast_to
@mrocklin mrocklin merged commit 04198df into dask:master Mar 29, 2015
@shoyer shoyer deleted the broadcast_to branch March 29, 2015 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants