Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott committed Aug 19, 2021
1 parent a730c70 commit 0bae677
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/compiler/chainrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ The two-argument `_project(x, dx)` applies this immediately.
#
# But the original case was an array of Union{Int,Nothing}

# Solve some ambiguity:
(::ProjectTo{ChainRulesCore.NoTangent})(::ChainRulesCore.AbstractZero) = NoTangent()

"""
ZBack{F}(back) <: Function
Expand Down
2 changes: 1 addition & 1 deletion test/gradcheck.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,7 @@ end
# check that type is not unnecessarily promoted
# https://github.com/FluxML/Zygote.jl/issues/663
@test gradient(norm, randn(Float32, 2, 2)) isa Tuple{Matrix{Float32}}
@test gradient(norm, randn(Float32, 2, 2), 3) isa Tuple{Matrix{Float32},Float32}
@test gradient(norm, randn(Float32, 2, 2), 3) isa Tuple{Matrix{Float32},Float64}
@test gradient(norm, randn(Float32, 2, 2), 3f0) isa Tuple{Matrix{Float32},Float32}
@test gradient(norm, randn(ComplexF32, 2, 2), 3.5f0) isa Tuple{Matrix{ComplexF32},Float32}

Expand Down

0 comments on commit 0bae677

Please sign in to comment.