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

mark some tests as broken #1545

Merged
merged 7 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 2 additions & 4 deletions src/forward/lib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ function _pushforward(dargs, ::typeof(Core._apply), f, args...)
Core._apply(_pushforward, ((df, dargs...), f), args...)
end

if VERSION >= v"1.4.0-DEV.304"
_pushforward(dargs, ::typeof(Core._apply_iterate), ::typeof(iterate), f, args...) =
_pushforward((first(args), tail(tail(dargs))...), Core._apply, f, args...)
end
_pushforward(dargs, ::typeof(Core._apply_iterate), ::typeof(iterate), f, args...) =
_pushforward((first(args), tail(tail(dargs))...), Core._apply, f, args...)

using ..Zygote: literal_getproperty, literal_getfield, literal_getindex

Expand Down
16 changes: 7 additions & 9 deletions src/lib/lib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,13 @@
end
end

if VERSION >= v"1.4.0-DEV.304"
@adjoint! function Core._apply_iterate(::typeof(iterate), f, args...)
y, back = Core._apply(_pullback, (__context__, f), args...)
st = map(_empty, args)
y, function (Δ)
Δ = back(Δ)
Δ === nothing ? nothing :
(nothing, first(Δ), unapply(st, Base.tail(Δ))...)
end
@adjoint! function Core._apply_iterate(::typeof(iterate), f, args...)

Check warning on line 201 in src/lib/lib.jl

View check run for this annotation

Codecov / codecov/patch

src/lib/lib.jl#L201

Added line #L201 was not covered by tests
y, back = Core._apply(_pullback, (__context__, f), args...)
st = map(_empty, args)
y, function (Δ)
Δ = back(Δ)
Δ === nothing ? nothing :
(nothing, first(Δ), unapply(st, Base.tail(Δ))...)
end
end

Expand Down
10 changes: 3 additions & 7 deletions test/chainrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,10 @@ using Zygote: ZygoteRuleConfig

@test (1,) == h(1)

if VERSION >= v"1.6-"
@test begin
a3, pb3 = Zygote.pullback(h, 1)
((1,),) == pb3(1)
end
else

@test begin
a3, pb3 = Zygote.pullback(h, 1)
@test ((1,),) == pb3(1)
((1,),) == pb3(1)
end
end

Expand Down
18 changes: 12 additions & 6 deletions test/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ y, back = pullback(badly, 2)
bt = try back(1) catch e stacktrace(catch_backtrace()) end

@test trace_contains(bt, nothing, "compiler.jl", bad_def_line)
if VERSION <= v"1.6-" || VERSION >= v"1.10-"
if VERSION >= v"1.10-"
@test trace_contains(bt, :badly, "compiler.jl", bad_call_line)
else
@test_broken trace_contains(bt, :badly, "compiler.jl", bad_call_line)
Expand Down Expand Up @@ -319,14 +319,17 @@ end
@test res == 12.
@test_throws ErrorException pull(1.)
err = try pull(1.) catch ex; ex end
@test occursin("Can't differentiate function execution in catch block",
string(err))
if VERSION >= v"1.11"
@test_broken occursin("Can't differentiate function execution in catch block", string(err))
else
@test occursin("Can't differentiate function execution in catch block", string(err))
end
end

if VERSION >= v"1.8"
@testset "try/catch/else" begin
@test Zygote.gradient(try_catch_else, false, 1.0) == (nothing, 8.0)
@test_throws "Can't differentiate function execution in catch block" Zygote.gradient(try_catch_else, true, 1.0)
@test_throws ErrorException Zygote.gradient(try_catch_else, true, 1.0)
end
end

Expand All @@ -348,6 +351,9 @@ end
@test_throws ErrorException pull(1.)

err = try pull(1.) catch ex; ex end
@test occursin("Can't differentiate function execution in catch block",
string(err))
if VERSION >= v"1.11"
@test_broken occursin("Can't differentiate function execution in catch block", string(err))
else
@test occursin("Can't differentiate function execution in catch block", string(err))
end
end
Loading
Loading