@@ -213,7 +213,7 @@ function test_rrule(
213
213
res === nothing && throw (MethodError (rrule_f, Tuple{Core. Typeof .(primals)... }))
214
214
y_ad, pullback = res
215
215
y = call (primals... )
216
- test_approx (y_ad, y; isapprox_kwargs... ) # make sure primal is correct
216
+ test_approx (y_ad, y, " Failed primal value check " ; isapprox_kwargs... ) # make sure primal is correct
217
217
218
218
ȳ = output_tangent isa Auto ? rand_tangent (y) : output_tangent
219
219
@@ -231,7 +231,8 @@ function test_rrule(
231
231
# Correctness testing via finite differencing.
232
232
is_ignored = isa .(accum_cotangents, NoTangent)
233
233
fd_cotangents = _make_j′vp_call (fdm, call, ȳ, primals, is_ignored)
234
- foreach (accum_cotangents, ad_cotangents, fd_cotangents) do args...
234
+ msgs = ntuple (i-> " cotangent for input $i , $(summary (fd_cotangents[i])) " , length (fd_cotangents))
235
+ foreach (accum_cotangents, ad_cotangents, fd_cotangents, msgs) do args...
235
236
_test_cotangent (args... ; check_inferred= check_inferred, isapprox_kwargs... )
236
237
end
237
238
@@ -298,14 +299,15 @@ If `accum_cotangent` is `NoTangent()`, i.e., the argument was marked as non-diff
298
299
function _test_cotangent (
299
300
accum_cotangent,
300
301
ad_cotangent,
301
- fd_cotangent;
302
+ fd_cotangent,
303
+ msg= " " ;
302
304
check_inferred= true ,
303
305
kwargs... ,
304
306
)
305
307
ad_cotangent isa AbstractThunk && check_inferred && _test_inferred (unthunk, ad_cotangent)
306
308
307
309
# The main test of the actual derivative being correct:
308
- test_approx (ad_cotangent, fd_cotangent; kwargs... )
310
+ test_approx (ad_cotangent, fd_cotangent, msg ; kwargs... )
309
311
_test_add!!_behaviour (accum_cotangent, ad_cotangent; kwargs... )
310
312
end
311
313
0 commit comments