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

Add TrackedArray support for repeat(x; inner, outer) #270

Merged
merged 1 commit into from
Jun 6, 2018

Conversation

staticfloat
Copy link
Contributor

This makes it really easy to do things like make Upsample layers, which are pretty useful for autoencoders.

@MikeInnes
Copy link
Member

This looks good, but it'd be worth considering how we make this work with the GPU eventually. Is there a more broadcast-y way to do this, or do we need an inverse-repeat kernel?

@staticfloat
Copy link
Contributor Author

Yeah, this is pretty straightforward, so I imagine writing a GPU-friendly kernel wouldn't be too hard; just some index processing.

What does a "more broadcast-y" way mean? I'm not sure how to think about a "broadcasted" kernel in this context, since the index of the input data and the index of the output data are not the same. Additionally, it's not a one-to-one mapping; each input will be written to an output multiple times.

@MikeInnes
Copy link
Member

Yeah I just meant using existing GPU-friendly primitives; you can sometimes hack broadcasting to do stuff like this (e.g. kronecker products) but it sounds like that's not really the case here. I'm sure we can figure out the kernel later anyway.

@staticfloat
Copy link
Contributor Author

I suppose you could write a massively parallel version where you construct a source index from every destination index, then run A[dest_idxs] .= B[src_idxs].

@MikeInnes
Copy link
Member

@americast might be worth looking at what this needs to work on the GPU.

@staticfloat thanks for the patch!

@MikeInnes MikeInnes merged commit af8f334 into FluxML:master Jun 6, 2018
@americast
Copy link
Contributor

americast commented Jun 6, 2018 via email

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.

3 participants