Skip to content

Should we generate AbstractArray rand_tangent for all AbstractArray subtypes? #198

Open
@oxinabox

Description

@oxinabox

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 and similar like Zygote does for getindex
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 to x::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 than Composite is.
It can still screw up, but as long as it screws up less, or with a clearer error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions