Skip to content

Commit

Permalink
Fix tests for ZygoteRule change
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion authored Oct 25, 2023
1 parent f755127 commit e8db020
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Requires = "1.1"
PrecompileTools = "1"
SpecialFunctions = "1.6, 2"
Tracker = "0.2"
ZygoteRules = "0.2.1"
ZygoteRules = "0.2.4"
julia = "1.6"

[extensions]
Expand Down
4 changes: 2 additions & 2 deletions test/gradcheck.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ end
@test gradtest(X -> sum(sum(x -> x^2, X; dims=1)), randn(10)) # issue #681

# Non-differentiable sum of booleans
@test gradient(sum, [true, false, true]) == (nothing,)
@test gradient(sum, [true, false, true]) === nothing
@test gradient(x->sum(x .== 0.0), [1.2, 0.2, 0.0, -1.1, 100.0]) == (nothing,)

# https://github.com/FluxML/Zygote.jl/issues/314
Expand Down Expand Up @@ -178,7 +178,7 @@ end

# Ensure that nothings work with non-numeric types.
_, back = Zygote.pullback(getindex, [randn(2) for _ in 1:3], [1])
@test back([nothing]) == (nothing, nothing)
@test back([nothing]) === nothing
end

@testset "view" begin
Expand Down
2 changes: 1 addition & 1 deletion test/structures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ end
end

m, b = Zygote._pullback(Zygote.Context(), nameof, M)
@test b(m) == (nothing, nothing)
@test b(m) === nothing
end

0 comments on commit e8db020

Please sign in to comment.