283283function DI. prepare_hvp (
284284 f, backend:: AutoPolyesterForwardDiff , x, tx:: NTuple , contexts:: Vararg{Context,C}
285285) where {C}
286- return DI. prepare_hvp (f, single_threaded (backend), x, tx, contexts... )
286+ return DI. prepare_hvp (
287+ f, SecondOrder (single_threaded (backend), backend), x, tx, contexts...
288+ )
287289end
288290
289291function DI. hvp (
@@ -294,7 +296,9 @@ function DI.hvp(
294296 tx:: NTuple ,
295297 contexts:: Vararg{Context,C} ,
296298) where {C}
297- return DI. hvp (f, prep, single_threaded (backend), x, tx, contexts... )
299+ return DI. hvp (
300+ f, prep, SecondOrder (single_threaded (backend), backend), x, tx, contexts...
301+ )
298302end
299303
300304function DI. hvp! (
@@ -306,7 +310,9 @@ function DI.hvp!(
306310 tx:: NTuple ,
307311 contexts:: Vararg{Context,C} ,
308312) where {C}
309- return DI. hvp! (f, tg, prep, single_threaded (backend), x, tx, contexts... )
313+ return DI. hvp! (
314+ f, tg, prep, SecondOrder (single_threaded (backend), backend), x, tx, contexts...
315+ )
310316end
311317
312318function DI. gradient_and_hvp (
@@ -317,7 +323,9 @@ function DI.gradient_and_hvp(
317323 tx:: NTuple ,
318324 contexts:: Vararg{Context,C} ,
319325) where {C}
320- return DI. gradient_and_hvp (f, prep, single_threaded (backend), x, tx, contexts... )
326+ return DI. gradient_and_hvp (
327+ f, prep, SecondOrder (single_threaded (backend), backend), x, tx, contexts...
328+ )
321329end
322330
323331function DI. gradient_and_hvp! (
@@ -331,7 +339,14 @@ function DI.gradient_and_hvp!(
331339 contexts:: Vararg{Context,C} ,
332340) where {C}
333341 return DI. gradient_and_hvp! (
334- f, grad, tg, prep, single_threaded (backend), x, tx, contexts...
342+ f,
343+ grad,
344+ tg,
345+ prep,
346+ SecondOrder (single_threaded (backend), backend),
347+ x,
348+ tx,
349+ contexts... ,
335350 )
336351end
337352
0 commit comments