@@ -131,14 +131,10 @@ function test_bijector(
131
131
test_bijector_reals (b, x_true, y_true, logjac_true; kwargs... )
132
132
133
133
# Test AD
134
- if isclosedform (b)
135
- test_ad (x -> b (first (x)), [x_true, ])
136
- end
134
+ test_ad (x -> b (first (x)), [x_true, ])
137
135
138
- if isclosedform (ib)
139
- y = b (x_true)
140
- test_ad (x -> ib (first (x)), [y, ])
141
- end
136
+ y = b (x_true)
137
+ test_ad (x -> ib (first (x)), [y, ])
142
138
143
139
test_ad (x -> logabsdetjac (b, first (x)), [x_true, ])
144
140
end
@@ -167,28 +163,20 @@ function test_bijector(
167
163
test_bijector_arrays (b, collect (x_true), collect (y_true), logjac_true; kwargs... )
168
164
169
165
# Test AD
170
- if isclosedform (b)
171
- test_ad (x -> sum (b (x)), collect (x_true))
172
- end
173
- if isclosedform (ib)
174
- y = b (x_true)
175
- test_ad (x -> sum (ib (x)), y)
176
- end
166
+ test_ad (x -> sum (b (x)), collect (x_true))
167
+ y = b (x_true)
168
+ test_ad (x -> sum (ib (x)), y)
177
169
178
170
test_ad (x -> logabsdetjac (b, x), x_true)
179
171
end
180
172
end
181
173
182
174
function test_logabsdetjac (b:: Bijector{1} , xs:: AbstractMatrix ; tol= 1e-6 )
183
- if isclosedform (b)
184
- logjac_ad = [logabsdet (ForwardDiff. jacobian (b, x))[1 ] for x in eachcol (xs)]
185
- @test mean (logabsdetjac (b, xs) - logjac_ad) ≤ tol
186
- end
175
+ logjac_ad = [logabsdet (ForwardDiff. jacobian (b, x))[1 ] for x in eachcol (xs)]
176
+ @test mean (logabsdetjac (b, xs) - logjac_ad) ≤ tol
187
177
end
188
178
189
179
function test_logabsdetjac (b:: Bijector{0} , xs:: AbstractVector ; tol= 1e-6 )
190
- if isclosedform (b)
191
- logjac_ad = [log (abs (ForwardDiff. derivative (b, x))) for x in xs]
192
- @test mean (logabsdetjac (b, xs) - logjac_ad) ≤ tol
193
- end
180
+ logjac_ad = [log (abs (ForwardDiff. derivative (b, x))) for x in xs]
181
+ @test mean (logabsdetjac (b, xs) - logjac_ad) ≤ tol
194
182
end
0 commit comments