Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ChainRules"
uuid = "082447d4-558c-5d27-93f4-14fc19e9eca2"
version = "1.72.5"
version = "1.72.6"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
6 changes: 4 additions & 2 deletions src/rulesets/Base/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,10 @@ function rrule(config::RuleConfig{>:HasReverseMode}, ::typeof(map), f::F, xs::Tu
y = map(first, hobbits)
num_xs = Val(length(xs))
paddings = map(x -> ntuple(Returns(NoTangent()), (length(x) - length_y)), xs)
all(isempty, paddings) || @error """map(f, xs::Tuple...) does not allow mistmatched lengths!
But its `rrule` does; when JuliaLang/julia #42216 is fixed this warning should be removed."""
@static if VERSION < v"1.10.0-alpha1"
all(isempty, paddings) || @error """map(f, xs::Tuple...) does not allow mismatched lengths in Julia <1.10!
But its `rrule` does."""
end
function map_pullback(dy_raw)
dy = unthunk(dy_raw)
# We want to call the pullbacks in `rrule_via_ad` in reverse sequence to the forward pass:
Expand Down
4 changes: 2 additions & 2 deletions test/rulesets/Base/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ end
test_rrule(map, make_two_vec, (4.0, 5.0 + 6im), check_inferred=false)
test_rrule(map, Multiplier(rand() + im), Tuple(rand(3)), check_inferred=false)

if try map(+, (1,), (2,3)); true catch e; false end
# True when https://github.com/JuliaLang/julia/issues/42216 has been fixed
if VERSION >= v"1.10.0-alpha1"
# Mismatched lengths were not allowed before 1.10
test_rrule(map, Multiplier(4.5), (6.7, 8.9), (0.1, 0.2, 0.3), check_inferred=false)
end
end
Expand Down
Loading