Skip to content

Commit 65410e5

Browse files
mobledevmotion
andauthored
Remove old warning about map (#825)
* Skip length check in map on newer Julia versions Closes #798 * Apply suggestions from code review Co-authored-by: David Müller-Widmann <[email protected]> --------- Co-authored-by: David Müller-Widmann <[email protected]>
1 parent 2dad6a7 commit 65410e5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/rulesets/Base/base.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,10 @@ function rrule(config::RuleConfig{>:HasReverseMode}, ::typeof(map), f::F, xs::Tu
281281
y = map(first, hobbits)
282282
num_xs = Val(length(xs))
283283
paddings = map(x -> ntuple(Returns(NoTangent()), (length(x) - length_y)), xs)
284-
all(isempty, paddings) || @error """map(f, xs::Tuple...) does not allow mistmatched lengths!
285-
But its `rrule` does; when JuliaLang/julia #42216 is fixed this warning should be removed."""
284+
@static if VERSION < v"1.10.0-DEV.1194"
285+
all(isempty, paddings) || @error """map(f, xs::Tuple...) does not allow mismatched lengths in Julia <1.10!
286+
But its `rrule` does."""
287+
end
286288
function map_pullback(dy_raw)
287289
dy = unthunk(dy_raw)
288290
# We want to call the pullbacks in `rrule_via_ad` in reverse sequence to the forward pass:

test/rulesets/Base/base.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ end
253253
test_rrule(map, make_two_vec, (4.0, 5.0 + 6im), check_inferred=false)
254254
test_rrule(map, Multiplier(rand() + im), Tuple(rand(3)), check_inferred=false)
255255

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

0 commit comments

Comments
 (0)