Skip to content

Commit d1c68a9

Browse files
st--CompatHelper Julia
and
CompatHelper Julia
authored
fix Distances compat (#423)
* CompatHelper: bump compat for Distances to 0.10 for package test, (keep existing compat) * try out Theo's fix * fix test compat * use ForwardDiff for chain rule test of SqMahalanobis * test on 1.4 instead of 1.3 - see if the chainrules test passes there * revert version branch * revert to 1.3 * test_broken for older Julia versions Co-authored-by: CompatHelper Julia <[email protected]>
1 parent 93d33c2 commit d1c68a9

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/chainrules.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function ChainRulesCore.rrule(s::Sinus, x::AbstractVector, y::AbstractVector)
118118
return val, evaluate_pullback
119119
end
120120

121-
## Reverse Rulse SqMahalanobis
121+
## Reverse Rules SqMahalanobis
122122

123123
function ChainRulesCore.rrule(
124124
dist::Distances.SqMahalanobis, a::AbstractVector, b::AbstractVector

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
1919
[compat]
2020
AxisArrays = "0.4.3"
2121
Compat = "3"
22-
Distances = "= 0.10.0, = 0.10.1, = 0.10.2, = 0.10.3, = 0.10.4"
22+
Distances = "0.10"
2323
Documenter = "0.25, 0.26, 0.27"
2424
FiniteDifferences = "0.10.8, 0.11, 0.12"
2525
ForwardDiff = "0.10"

test/chainrules.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
compare_gradient(:Zygote, [x, y]) do xy
2222
KernelFunctions.Sinus(r)(xy[1], xy[2])
2323
end
24-
compare_gradient(:Zygote, [Q, x, y]) do xy
25-
SqMahalanobis(xy[1])(xy[2], xy[3])
24+
if VERSION < v"1.6"
25+
@test_broken "Chain rule of SqMahalanobis is broken in Julia pre-1.6"
26+
else
27+
compare_gradient(:Zygote, [Q, x, y]) do Qxy
28+
SqMahalanobis(Qxy[1])(Qxy[2], Qxy[3])
29+
end
2630
end
2731
end

0 commit comments

Comments
 (0)