JuliaDiff / JuliaDiff/FiniteDifferences.jl
infinite recursion of to_vec for wrapped arrays
Open
@willtebbutt is already working on this.
Since Jan 20, 2021.
bug
- Dominant language
- Julia
- Stars
- 318
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Description
I didn't look at the implementation details of to_vec but I wanted to report a bug we encountered in
https://github.com/FluxML/NNlib.jl/pull/272 when applying to_vec to a custom array wrapper.
142
AutoDiff: Error During Test at /home/runner/work/NNlib.jl/NNlib.jl/test/batchedmul.jl:235
143
Got exception outside of a @test
144
StackOverflowError:
145
Stacktrace:
146
[1] to_vec(x::BatchedAdjoint{Float64, Array{Float64, 3}})
147
@ FiniteDifferences ~/.julia/packages/FiniteDifferences/7NROH/src/to_vec.jl:56
148
[2] to_vec(x::Base.ReshapedArray{Float64, 1, BatchedAdjoint{Float64, Array{Float64, 3}}, Tuple{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64}, Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64}}})
149
@ FiniteDifferences ~/.julia/packages/FiniteDifferences/7NROH/src/to_vec.jl:69
150
[3] to_vec(x::BatchedAdjoint{Float64, Array{Float64, 3}})
151
@ FiniteDifferences ~/.julia/packages/FiniteDifferences/7NROH/src/to_vec.jl:57--- the last 2 lines are repeated 39990 more times ---
We worked around the issue defining:
FiniteDifferences.to_vec(x::BatchedAdjoint) = FiniteDifferences.to_vec(collect(x))
Could this be used as a generic fallback?
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.
Assessment
This issue has not been assessed yet.