You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But maybe for rand_tangent we don't need to do so well, we just need to make something that is more likely to be what the user expects than Composite is.
It can still screw up, but as long as it screws up less, or with a clearer error.
The text was updated successfully, but these errors were encountered:
I maintain that rand_tangent currently has the correct default behaviour. As I see it, there are two things that need to be done.
First thing
signpost it better: "if you've got a custom array type that isn't a StridedArray and you don't want to treat like a struct, you'll need to teach rand_tangent what to do",
make this really easy to do. Either a macro, or just a function, so that implementing rand_tangent for your AbstractArray is a one-liner.
Second thing
Implement this so that it's easier for rule-implementers to get this right / to convert to their preferred types when writing rules.
mzgubic
transferred this issue from JuliaDiff/ChainRulesTestUtils.jl
Apr 8, 2021
mzgubic
transferred this issue from JuliaDiff/FiniteDifferences.jl
Jul 27, 2021
See discussion at https://discourse.julialang.org/t/chainrulescore-rrule-for-custom-struct-does-the-pullback-need-to-support-composite-explicitly/56734
We can maybe do something with
zero
andsimilar
like Zygote does forgetindex
https://github.com/FluxML/Zygote.jl/blob/956cbcf3c572c0eb09c146189bb38b1b434634ff/src/lib/array.jl#L47-L49
I find thought when i was working on the
getindex
for ChainRules (JuliaDiff/ChainRules.jl#240) trying to work this out for general case is actually really hard, i gave up and restricteds tox::Array{<:Number}
.But maybe for
rand_tangent
we don't need to do so well, we just need to make something that is more likely to be what the user expects thanComposite
is.It can still screw up, but as long as it screws up less, or with a clearer error.
The text was updated successfully, but these errors were encountered: