Commit 0513e89
Fix rrule for broadcasted over empty Tuple{} (#834)
* Fix rrule for broadcasted over empty Tuple{}
When broadcasting over an empty tuple, `Broadcast.combine_eltypes` returns
`Union{}`. Since `Union{} <: Number` is true, the code entered
`may_bc_derivatives` which tried to construct `Tuple{Union{}, ...}` and
errored. Fix by treating `Union{}` as a trivial non-differentiable case
alongside `Bool`.
Fixes #830
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* Update test/rulesets/Base/broadcast.jl
Co-authored-by: David Müller-Widmann <[email protected]>
* Update test/rulesets/Base/broadcast.jl
Co-authored-by: David Müller-Widmann <[email protected]>
* Add multi-argument test for broadcast over empty tuples
Test atan.((), ()) to cover the multi-arg path through the trivial
broadcast rrule when eltype is Union{}.
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---------
Co-authored-by: ChrisRackauckas-Claude <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: David Müller-Widmann <[email protected]>1 parent 9dbb830 commit 0513e89
2 files changed
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
180 | 194 | | |
181 | 195 | | |
182 | 196 | | |
| |||
0 commit comments