-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
Fix Flux.flip by providing an adjoint for Base.reverse #515
Conversation
Does it fix |
Yes it does. Tests would have to go in |
Having the PR up would be helpful, I think it's one of the tail end of fixes remaining to update the zoo as well |
oh right, thought flip was a Base function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
src/lib/array.jl
Outdated
@adjoint function reverse(x::AbstractArray, args...; kwargs...) | ||
_reverse(t) = reverse(t, args...; kwargs...) | ||
_nothings(t) = map(_->nothing, keys(t)) | ||
_reverse(x), Δ->(_reverse(Δ), _nothings(args)..., _nothings(kwargs)...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to return adjoints for the kwargs here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, duly noted
this seems good to go |
bors r+ |
Build succeeded |
The main motivation behind this PR is to address various issues concerning
Flux.flip()
(used mainly for bRNNs), e.g. FluxML/Flux.jl#962, FluxML/Flux.jl#990 and FluxML/model-zoo#179