JuliaDiff / JuliaDiff/ChainRulesTestUtils.jl

Should we generate AbstractArray rand_tangent for all AbstractArray subtypes?

Open
#198 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
50
Forks
18
PR merge metrics
No merged PRs in 30d

Description

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 (https://github.com/JuliaDiff/ChainRules.jl/pull/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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Discourse discussion and ChainRules getindex PR #240 to understand the unresolved behavior. Compare the referenced Zygote implementation in src/lib/array.jl with the current rand_tangent behavior. Done means the project has an agreed approach for AbstractArray subtypes, with its failure behavior and expected coverage defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.