JuliaDiff / JuliaDiff/ReverseDiff.jl
The number of arguments limitation of the forward macro.
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 393
- Forks
- 60
- Avg merge
- 18h 24m
- Merged PRs (30d)
- 8
Description
The docstring of ReverseDiff.@forward says:
Currently, only
length(args) <= 2is supported.
However, in a simple function, this macro looks working well even for >3 arguments:
julia> import ReverseDiff
julia> ReverseDiff.@forward f(x, y, z, w) = x + 2y + 3z + 4w
ReverseDiff.ForwardOptimize{##hidden_f}(#hidden_f)
julia> f(1.0, 2.0, 3.0, 4.0)
30.0
julia> ∇f = ReverseDiff.compile_gradient(x -> f(x[1], x[2], x[3], x[4]), zeros(4))
(::#301) (generic function with 1 method)
julia> ∇f(zeros(4), ones(4))
4-element Array{Float64,1}:
1.0
2.0
3.0
4.0
Can I expect this works always or is there any pitfall in the case?
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 reading the ReverseDiff.@forward docstring and reproducing the shown example with more than two arguments. Then inspect how @forward interacts with compile_gradient; done means establishing whether the documented limitation is real and recording the supported behavior or any pitfall.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100