JuliaDiff / JuliaDiff/ChainRulesTestUtils.jl
Add function for checking modules for type piracy, ambiguities, etc in defined rules
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 50
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
Given an example like
struct Foo end
(f::Foo)(x) = x^2
function ChainRulesCore.rrule(::typeof(Foo), x)
Foo_pullback(Δy) = (NO_FIELDS, x' * Δy + Δy * x')
return x^2, Foo_pullback
end
Because typeof(Foo) is DataType, this common mistake is highly piratical and will subtilely and completely break AD packages like Zygote for anyone who has this rule in their namespace (it should be ::Foo in the signature, not typeof(Foo)).
On Slack, @oxinabox suggested:
We should think about tools to make this more obvious.
Maybe something that lists the true things that have been targetted by all rules defined in a package?
I suggested:
Something like
ChainRulesTestUtils.check_all_rules(MyModule)which as much as possible checks for things like type piracy, ambiguities, etc?
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 reviewing the proposed ChainRulesTestUtils.check_all_rules(MyModule) entry point and the Julia rule example in this issue. Determine how the utility should identify incorrect targets, type piracy, and ambiguities, then define checks and completion criteria for reporting those problems across a module.
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