Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule for foldl fails on empty tuple #672

Open
mcabbott opened this issue Aug 29, 2022 · 0 comments · May be fixed by #569
Open

Rule for foldl fails on empty tuple #672

mcabbott opened this issue Aug 29, 2022 · 0 comments · May be fixed by #569
Labels
bug Something isn't working

Comments

@mcabbott
Copy link
Member

Found here: FluxML/Zygote.jl#1297

julia> using ChainRules, ChainRulesCore, ChainRulesTestUtils

julia> const CFG = ChainRulesTestUtils.TestConfig();

julia> foldl(/, (), init=0)
0

julia> rrule(CFG, foldl, /, (), init=0)
ERROR: BoundsError: attempt to access Tuple{} at index [0]
Stacktrace:
 [1] getindex(t::Tuple, i::Int64)
   @ Base ./tuple.jl:29
 [2] last(a::Tuple{})
   @ Base ./abstractarray.jl:500
 [3] rrule(config::ChainRulesTestUtils.TestConfig, ::typeof(foldl), op::typeof(/), x::Tuple{}; init::Int64)
   @ ChainRules ~/.julia/packages/ChainRules/fgVxV/src/rulesets/Base/mapreduce.jl:448
@mcabbott mcabbott added the bug Something isn't working label Aug 29, 2022
mcabbott added a commit to mcabbott/ChainRules.jl that referenced this issue Aug 29, 2022
@mcabbott mcabbott linked a pull request Aug 29, 2022 that will close this issue
mcabbott added a commit to mcabbott/ChainRules.jl that referenced this issue Aug 30, 2022
mcabbott added a commit to mcabbott/ChainRules.jl that referenced this issue Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant