JuliaDiff / JuliaDiff/ChainRulesTestUtils.jl
Support MutableTangent automatically
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 50
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
This is a follow up to https://github.com/JuliaDiff/ChainRulesCore.jl/issues/105#issuecomment-1655958008
Right now, using https://github.com/JuliaDiff/ChainRulesCore.jl/pull/626 if you want to test something that MutableTangent that does work e.g.:
test_frule(setfield!, MDemo(3.5)⊢MutableTangent{MDemo}(x=2.0), :x, 5.0)
But if you just do:
test_frule(setfield!, MDemo(3.5), :x, 5.0)
you get an error because the default type we use for structural tangents is the immutable Tangent
We could use the StructuralTangent constructor to automatically chose MutableTangent for mutable primals.
we would want to do that forwardward mode, at least. Not sure if we should also do that in reverse
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the linked issue comment and PR 626, then inspect the StructuralTangent and test_frule entry points. Verify that mutable primals select MutableTangent automatically in forward mode, and determine whether reverse mode should receive the same treatment. Done means the provided setfield! example works without an explicit tangent type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100