@@ -183,16 +183,16 @@ All keyword arguments except for `fdm` and `fkwargs` are passed to `isapprox`.
183
183
function frule_test (f, xẋs:: Tuple{Any, Any} ...; rtol= 1e-9 , atol= 1e-9 , fdm= _fdm, fkwargs= NamedTuple (), kwargs... )
184
184
_ensure_not_running_on_functor (f, " frule_test" )
185
185
xs, ẋs = first .(xẋs), last .(xẋs)
186
- Ω_ad, dΩ_ad = frule ((NO_FIELDS, ẋs ... ), f, xs ... ; fkwargs... )
187
- Ω = f (xs ... ; fkwargs... )
186
+ Ω_ad, dΩ_ad = frule ((NO_FIELDS, deepcopy (ẋs) ... ), f, deepcopy (xs) ... ; deepcopy ( fkwargs) ... )
187
+ Ω = f (deepcopy (xs) ... ; deepcopy ( fkwargs) ... )
188
188
# if equality check fails, check approximate equality
189
189
# use collect so can do vector equality
190
190
# TODO : add isapprox replacement that works for more types
191
191
@test Ω_ad == Ω || isapprox (collect (Ω_ad), collect (Ω); rtol= rtol, atol= atol)
192
192
193
193
ẋs_is_ignored = ẋs .== nothing
194
194
# Correctness testing via finite differencing.
195
- dΩ_fd = _make_jvp_call (fdm, (xs... ) -> f (xs ... ; fkwargs... ), xs, ẋs, ẋs_is_ignored)
195
+ dΩ_fd = _make_jvp_call (fdm, (xs... ) -> f (deepcopy (xs) ... ; deepcopy ( fkwargs) ... ), xs, ẋs, ẋs_is_ignored)
196
196
@test isapprox (
197
197
collect (extern .(dΩ_ad)), # Use collect so can use vector equality
198
198
collect (dΩ_fd);
0 commit comments