JuliaDiff / JuliaDiff/ChainRulesTestUtils.jl
Support testing chunked forward mode
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 50
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
Consider this (From #36)
simo(x) = (x, 2x)
function ChainRulesCore.frule((_, ẋ), simo, x)
y = simo(x)
return y, Composite{typeof(y)}(ẋ, 2ẋ)
end
I believe that that the following should work:
frule_test(simo, (randn(), randn(4))) # chunked mode, scalar/vector
frule_test(simo, (randn(3), randn(2, 3))) # chunked mode, vector/matrix
as I believe the following is the correct chunked mode behavour.
@YingboMa am i right?
at least for the scalar primal and vector differential
julia> frule((Zero(), [1, 2, 3]), simo, π)
((π, 6.283185307179586), ([1, 2, 3], [2, 4, 6]))
julia> frule((Zero(), [1 1; 0 1; 1 0]), simo, [1, 1, 1])
(([1, 1, 1], [2, 2, 2]), Composite{Tuple{Array{Int64,1},Array{Int64,1}}}([1 1; 0 1; 1 0], [2 2; 0 2; 2 0]))
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 with the existing frule_test calls and the frule examples shown in this issue, then review the discussion in #36. Determine the expected chunked forward-mode behavior for scalar/vector and vector/matrix inputs, and confirm that frule_test accepts both cases with the demonstrated outputs.
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
- Needs clarification
- Newbie friendliness
- 28/100