-
Notifications
You must be signed in to change notification settings - Fork 65
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
using ChainRulesCore
norm(NoTangent())
leads to
ERROR: StackOverflowError:
Stacktrace:
[1] norm(itr::NoTangent)
@ LinearAlgebra ~/packages/julias/julia-1.9/share/julia/stdlib/v1.9/LinearAlgebra/src/generic.jl:596
[2] (::Base.MappingRF{typeof(norm), Base.BottomRF{typeof(max)}})(acc::Base._InitialValue, x::NoTangent)
@ Base ./reduce.jl:95
[3] _foldl_impl(op::Base.MappingRF{typeof(norm), Base.BottomRF{typeof(max)}}, init::Base._InitialValue, itr::NoTangent)
@ Base ./reduce.jl:58
[4] foldl_impl(op::Base.MappingRF{typeof(norm), Base.BottomRF{typeof(max)}}, nt::Base._InitialValue, itr::NoTangent)
@ Base ./reduce.jl:48
[5] mapfoldl_impl(f::typeof(norm), op::typeof(max), nt::Base._InitialValue, itr::NoTangent)
@ Base ./reduce.jl:44
[6] mapfoldl(f::Function, op::Function, itr::NoTangent; init::Base._InitialValue)
@ Base ./reduce.jl:170
[7] mapfoldl
@ ./reduce.jl:170 [inlined]
[8] #mapreduce#292
@ ./reduce.jl:302 [inlined]
[9] mapreduce(f::Function, op::Function, itr::NoTangent)
@ Base ./reduce.jl:302
[10] generic_normInf(x::NoTangent)
@ LinearAlgebra ~/packages/julias/julia-1.9/share/julia/stdlib/v1.9/LinearAlgebra/src/generic.jl:453
[11] normInf(x::NoTangent)
@ LinearAlgebra ~/packages/julias/julia-1.9/share/julia/stdlib/v1.9/LinearAlgebra/src/generic.jl:527
[12] generic_norm2(x::NoTangent)
@ LinearAlgebra ~/packages/julias/julia-1.9/share/julia/stdlib/v1.9/LinearAlgebra/src/generic.jl:463
[13] norm2
@ ~/packages/julias/julia-1.9/share/julia/stdlib/v1.9/LinearAlgebra/src/generic.jl:529 [inlined]
[14] norm(itr::NoTangent, p::Int64)
@ LinearAlgebra ~/packages/julias/julia-1.9/share/julia/stdlib/v1.9/LinearAlgebra/src/generic.jl:598
--- the last 14 lines are repeated 5712 more times ---
I encountered this while implementing a custom rrule for an integration routine. Then, integrating the tangent would check its norm for convergence, spilling the beans. Maybe this should error or return NaN instead.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers