Skip to content

fix Distances compat #423

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

Merged
merged 10 commits into from
Jan 13, 2022
Merged
2 changes: 1 addition & 1 deletion src/chainrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function ChainRulesCore.rrule(s::Sinus, x::AbstractVector, y::AbstractVector)
return val, evaluate_pullback
end

## Reverse Rulse SqMahalanobis
## Reverse Rules SqMahalanobis

function ChainRulesCore.rrule(
dist::Distances.SqMahalanobis, a::AbstractVector, b::AbstractVector
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
[compat]
AxisArrays = "0.4.3"
Compat = "3"
Distances = "= 0.10.0, = 0.10.1, = 0.10.2, = 0.10.3, = 0.10.4"
Distances = "0.10"
Documenter = "0.25, 0.26, 0.27"
FiniteDifferences = "0.10.8, 0.11, 0.12"
ForwardDiff = "0.10"
Expand Down
8 changes: 6 additions & 2 deletions test/chainrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
compare_gradient(:Zygote, [x, y]) do xy
KernelFunctions.Sinus(r)(xy[1], xy[2])
end
compare_gradient(:Zygote, [Q, x, y]) do xy
SqMahalanobis(xy[1])(xy[2], xy[3])
if VERSION < v"1.6"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for this check?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests seemed to pass fine as is on 1.6, and I don't want to skip checks if I can avoid it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but how is the Julia version relevant here? It does not affect the version of Distances that is used, so why can't we use the same test for all Julia versions? It also seems tests fail on Julia 1.3 currently.

Copy link
Member Author

@st-- st-- Jan 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relevant because it only fails in 1.3 (and 1.4). It passes with 1.6 and 1.7. [not tested on 1.5]

Should we just skip the test for 1.3? Or raise julia compat to 1.4 (part of Ubuntu 20.04) or 1.6 (LTS)?

@test_broken "Chain rule of SqMahalanobis is broken in Julia pre-1.6"
else
compare_gradient(:Zygote, [Q, x, y]) do Qxy
SqMahalanobis(Qxy[1])(Qxy[2], Qxy[3])
end
end
end