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 support for cat #156

Closed
wants to merge 6 commits into from
Closed

Add support for cat #156

wants to merge 6 commits into from

Conversation

americast
Copy link
Contributor

@MikeInnes Adds generic cat to Flux. Fixes #142.
The tests have been provided separately for cat as it needs a parameter which is not tracked.

@MikeInnes
Copy link
Member

MikeInnes commented Feb 5, 2018

Looks good!

You don't need a new gradtest function here, however. You can just do gradtest((a, b) -> cat(2, a, b), ...) etc, as other tests for similar functions do.

@americast
Copy link
Contributor Author

Thanks, @MikeInnes! Fixed it.

@MikeInnes
Copy link
Member

Ok so two comments on this:

(1) You can avoid array allocations (and type instability) by working with tuples for till_xs and xs_in_Δ. e.g. ntuple(i -> _, Val{ndims(Δ)}).
(2) Can you extend this to n arguments? Doesn't have to be done as part of this PR, unless it's easy to do.

@MikeInnes
Copy link
Member

Oh, and here's a test case that fails: @test gradtest((a, b) -> cat(2, a, b), rand(3), rand(3)).

@MikeInnes MikeInnes force-pushed the master branch 3 times, most recently from 86ae1fa to d222700 Compare February 18, 2018 12:51
@MikeInnes MikeInnes force-pushed the master branch 4 times, most recently from 027a922 to 5cc6813 Compare April 15, 2018 14:07
@MikeInnes MikeInnes mentioned this pull request May 1, 2018
gustafsson added a commit to gustafsson/Flux.jl that referenced this pull request May 2, 2018
gustafsson added a commit to gustafsson/Flux.jl that referenced this pull request May 2, 2018
Co-authored-by: americast <sayan.sinha@iitkgp.ac.in>
gustafsson added a commit to gustafsson/Flux.jl that referenced this pull request May 2, 2018
Co-authored-by: americast <sayan.sinha@iitkgp.ac.in>
@MikeInnes
Copy link
Member

Merged with #243 -- thanks 👍

@MikeInnes MikeInnes closed this May 7, 2018
MikeInnes pushed a commit that referenced this pull request Jun 20, 2018
Co-authored-by: americast <sayan.sinha@iitkgp.ac.in>
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.

2 participants