JuliaDiff / JuliaDiff/ChainRulesTestUtils.jl
Supporting tests for mutating rules
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 50
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
I know mutating rules aren't fully supported yet, but I've started implementing some, following the guidelines in this tweet. To support testing mutating functions, I think only a few changes are needed:
- Because the mutating function might use the values of an input before overwriting it, it is only safe to call the function multiple times as the testers do on copies of the inputs. Specifically deep copies. So the idea is to only pass deep copies of inputs to the functions in the testers.
- Because the pullback must undo the mutation, after calling the pullback, check that the copies of the inputs that were passed to the
rruleare approximately equal to the original inputs.
For an example of how this might work, see this working implementation.
Am I missing anything, or are there any objections to me preemptively making these changes?
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
Start by comparing the existing testers with the working example in test/diffrules.jl. Confirm whether testers pass deep copies to mutating functions and verify after pullback that the copied inputs approximately match their originals; done means these checks support mutating-rule tests without breaking existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100