You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@testgradient(Val(AD), x ->kappa(k, exp(x[1])), [d]) ≈gradient(Val(:FiniteDiff), x ->kappa(k, exp(x[1])), [d]) atol=1e-8 rtol=1e-5
107
+
@testcompare_gradient(AD, [d]) do x
108
+
kappa(k, exp(x[1])
109
+
end
89
110
end
90
111
end
91
112
# Testing kernel evaluations
92
113
x =rand(rng, dims[1])
93
114
y =rand(rng, dims[1])
94
-
@testgradient(Val(AD), x ->k(x, y), x) ≈gradient(Val(:FiniteDiff), x ->k(x, y), x) atol=1e-8 rtol=1e-5
95
-
@testgradient(Val(AD), y ->k(x, y), y) ≈gradient(Val(:FiniteDiff), y ->k(x, y), y) atol=1e-8 rtol=1e-5
115
+
@testcompare_gradient(AD, x) do x
116
+
k(x, y)
117
+
end
118
+
@testcompare_gradient(AD, y) do y
119
+
k(x, y)
120
+
end
96
121
if!(args ===nothing)
97
-
@testgradient(Val(AD), p ->kernelfunction(p)(x,y), args) ≈gradient(Val(:FiniteDiff), p ->kernelfunction(p)(x, y), args) atol=1e-8 rtol=1e-5
122
+
@testcompare_gradient(AD, args) do p
123
+
kernelfunction(p)(x,y)
124
+
end
98
125
end
99
126
# Testing kernel matrices
100
127
A =rand(rng, dims...)
101
128
B =rand(rng, dims...)
102
129
for dim in1:2
103
-
@testgradient(Val(AD), x ->testfunction(k, x, dim), A) ≈gradient(Val(:FiniteDiff), x ->testfunction(k, x, dim), A) atol=1e-8 rtol=1e-5
104
-
@testgradient(Val(AD), a ->testfunction(k, a, B, dim), A) ≈gradient(Val(:FiniteDiff), a ->testfunction(k, a, B, dim), A) atol=1e-8 rtol=1e-5
105
-
@testgradient(Val(AD), b ->testfunction(k, A, b, dim), B) ≈gradient(Val(:FiniteDiff), b ->testfunction(k, A, b, dim), B) atol=1e-8 rtol=1e-5
130
+
@testcompare_gradient(AD, A) do a
131
+
testfunction(k, a, dim)
132
+
end
133
+
@testconpare_gradient(AD, A) do a
134
+
testfunction(k, a, B, dim)
135
+
end
136
+
@testcompare_gradient(AD, B) do b
137
+
testfunction(k, A, b, dim)
138
+
end
106
139
if!(args ===nothing)
107
-
@testgradient(Val(AD), p ->testfunction(kernelfunction(p), A, dim), args) ≈gradient(Val(:FiniteDiff), p ->testfunction(kernelfunction(p), A, dim), args) atol=1e-8 rtol=1e-5
0 commit comments