-
-
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
rm adjoint
& transpose
adjoints
#1259
Conversation
src/lib/array.jl
Outdated
@adjoint parent(x::LinearAlgebra.Adjoint) = parent(x), ȳ -> (LinearAlgebra.Adjoint(ȳ),) | ||
@adjoint parent(x::LinearAlgebra.Transpose) = parent(x), ȳ -> (LinearAlgebra.Transpose(ȳ),) |
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.
I forgot that JuliaDiff/ChainRulesCore.jl#446 isn't merged, so removing these lines probably isn't a good idea.
Before:
julia> gradient(x -> first(parent(x)), [1,2,3]')[1]
1×3 adjoint(::Vector{Float64}) with eltype Float64:
1.0 0.0 0.0
This PR, with tagged CRC:
julia> gradient(x -> first(parent(x)), [1,2,3]')[1]
(parent = [1.0, 0.0, 0.0],)
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.
One alternative idea is to desguar the @adjoint
and overload _pullback
directly. That'll have the benefit of removing some unnecessary layers, while making it easier to do stuff like FluxML/ZygoteRules.jl#22.
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.
Glad to see there were tests for this, at least: fails on isapprox(::NamedTuple{(:parent,), ...}, ::Matrix{Float64})
.
Ok to merge? |
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.
Yes, I hadn't noticed 26ae24b
closes #1257