From cdbaff083f7eec488ad0f1d98af5284bc8f66aa1 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Thu, 6 Jun 2024 12:09:53 -0300 Subject: [PATCH 01/15] Add dual number-based implementations for ForwardDiff scalar derivatives --- .../onearg.jl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl index ad4aa0c61..1c95e9ea1 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl @@ -183,3 +183,20 @@ function DI.value_gradient_and_hessian( DiffResults.value(result), DiffResults.gradient(result), DiffResults.hessian(result) ) end + +function DI.value_and_derivative(f::F, ::AutoForwardDiff, x) where {F} + T = typeof(Tag(f, typeof(x))) + ydual = f(Dual{T}(x, one(x))) + return value(T, ydual), extract_derivative(T, ydual) +end + +function DI.value_derivative_and_second_derivative(f::F, ::AutoForwardDiff, x) where {F} + T = typeof(Tag(f, typeof(x))) + xdual = Dual{T}(x, one(x)) + T2 = typeof(Tag(f, typeof(xdual))) + ydual = f(Dual{T2}(xdual, one(xdual))) + v = value(T, value(T2, ydual)) + d = extract_derivative(T, value(T2, ydual)) + d2 = extract_derivative(T, extract_derivative(T2, ydual)) + return v, d, d2 +end From bab1eeb65a61303e35da1b52e18dc047008ff9e5 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Thu, 6 Jun 2024 13:31:45 -0300 Subject: [PATCH 02/15] Use functions from utils.jl --- .../onearg.jl | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl index 1c95e9ea1..f12cb4112 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl @@ -184,19 +184,21 @@ function DI.value_gradient_and_hessian( ) end -function DI.value_and_derivative(f::F, ::AutoForwardDiff, x) where {F} - T = typeof(Tag(f, typeof(x))) - ydual = f(Dual{T}(x, one(x))) - return value(T, ydual), extract_derivative(T, ydual) -end - -function DI.value_derivative_and_second_derivative(f::F, ::AutoForwardDiff, x) where {F} - T = typeof(Tag(f, typeof(x))) - xdual = Dual{T}(x, one(x)) - T2 = typeof(Tag(f, typeof(xdual))) - ydual = f(Dual{T2}(xdual, one(xdual))) - v = value(T, value(T2, ydual)) - d = extract_derivative(T, value(T2, ydual)) - d2 = extract_derivative(T, extract_derivative(T2, ydual)) +function DI.value_and_derivative(f::F, backend::AutoForwardDiff, x) where {F} + T = tag_type(f, backend, x) + ydual = f(make_dual(T, x, one(x))) + return myvalue(T, ydual), myderivative(T, ydual) +end + +function DI.value_derivative_and_second_derivative( + f::F, backend::AutoForwardDiff, x +) where {F} + T = tag_type(f, backend, x) + xdual = make_dual(T, x, one(x)) + T2 = tag_type(f, backend, xdual) + ydual = f(make_dual(T2, xdual, one(xdual))) + v = myvalue(T, value(T2, ydual)) + d = myderivative(T, value(T2, ydual)) + d2 = myderivative(T, myderivative(T2, ydual)) return v, d, d2 end From 0f25bc0745b472a27e9826172dd861cbd12895e8 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Thu, 6 Jun 2024 17:47:38 -0300 Subject: [PATCH 03/15] Fixup --- .../ext/DifferentiationInterfaceForwardDiffExt/onearg.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl index f12cb4112..689352093 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl @@ -197,8 +197,8 @@ function DI.value_derivative_and_second_derivative( xdual = make_dual(T, x, one(x)) T2 = tag_type(f, backend, xdual) ydual = f(make_dual(T2, xdual, one(xdual))) - v = myvalue(T, value(T2, ydual)) - d = myderivative(T, value(T2, ydual)) + v = myvalue(T, myvalue(T2, ydual)) + d = myderivative(T, myvalue(T2, ydual)) d2 = myderivative(T, myderivative(T2, ydual)) return v, d, d2 end From c5fc41195a6a02850fd25e4b9364e3bbabe85c39 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Thu, 6 Jun 2024 21:45:36 -0300 Subject: [PATCH 04/15] Reorder --- .../onearg.jl | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl index 689352093..ec035c389 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl @@ -61,6 +61,27 @@ function DI.pushforward!( return dy end +## Derivative + +function DI.value_and_derivative(f::F, backend::AutoForwardDiff, x) where {F} + T = tag_type(f, backend, x) + ydual = f(make_dual(T, x, one(x))) + return myvalue(T, ydual), myderivative(T, ydual) +end + +function DI.value_derivative_and_second_derivative( + f::F, backend::AutoForwardDiff, x +) where {F} + T = tag_type(f, backend, x) + xdual = make_dual(T, x, one(x)) + T2 = tag_type(f, backend, xdual) + ydual = f(make_dual(T2, xdual, one(xdual))) + v = myvalue(T, myvalue(T2, ydual)) + d = myderivative(T, myvalue(T2, ydual)) + d2 = myderivative(T, myderivative(T2, ydual)) + return v, d, d2 +end + ## Gradient struct ForwardDiffGradientExtras{C} <: GradientExtras @@ -183,22 +204,3 @@ function DI.value_gradient_and_hessian( DiffResults.value(result), DiffResults.gradient(result), DiffResults.hessian(result) ) end - -function DI.value_and_derivative(f::F, backend::AutoForwardDiff, x) where {F} - T = tag_type(f, backend, x) - ydual = f(make_dual(T, x, one(x))) - return myvalue(T, ydual), myderivative(T, ydual) -end - -function DI.value_derivative_and_second_derivative( - f::F, backend::AutoForwardDiff, x -) where {F} - T = tag_type(f, backend, x) - xdual = make_dual(T, x, one(x)) - T2 = tag_type(f, backend, xdual) - ydual = f(make_dual(T2, xdual, one(xdual))) - v = myvalue(T, myvalue(T2, ydual)) - d = myderivative(T, myvalue(T2, ydual)) - d2 = myderivative(T, myderivative(T2, ydual)) - return v, d, d2 -end From 45e85489c3026cd5fb8d9fe8ed2ca7dfb784871e Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Fri, 7 Jun 2024 10:24:10 +0200 Subject: [PATCH 05/15] Add preparation to see error --- .../ext/DifferentiationInterfaceForwardDiffExt/onearg.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl index ec035c389..835543986 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl @@ -63,6 +63,10 @@ end ## Derivative +function DI.prepare_derivative(f::F, backend::AutoForwardDiff, x) where {F} + return NoDerivativeExtras() +end + function DI.value_and_derivative(f::F, backend::AutoForwardDiff, x) where {F} T = tag_type(f, backend, x) ydual = f(make_dual(T, x, one(x))) From 60789a1eac2c3f49f0521e52ddefc73338216622 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 7 Jun 2024 08:32:12 -0300 Subject: [PATCH 06/15] Add derivative method --- .../DifferentiationInterfaceForwardDiffExt/onearg.jl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl index 835543986..ad4c2460b 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl @@ -67,14 +67,20 @@ function DI.prepare_derivative(f::F, backend::AutoForwardDiff, x) where {F} return NoDerivativeExtras() end -function DI.value_and_derivative(f::F, backend::AutoForwardDiff, x) where {F} +function DI.derivative(f::F, ::AutoForwardDiff, x, ::NoDerivativeExtras) where {F} + return derivative(f, x) +end + +function DI.value_and_derivative( + f::F, backend::AutoForwardDiff, x, ::NoDerivativeExtras +) where {F} T = tag_type(f, backend, x) ydual = f(make_dual(T, x, one(x))) return myvalue(T, ydual), myderivative(T, ydual) end function DI.value_derivative_and_second_derivative( - f::F, backend::AutoForwardDiff, x + f::F, backend::AutoForwardDiff, x, ::NoDerivativeExtras ) where {F} T = tag_type(f, backend, x) xdual = make_dual(T, x, one(x)) From 153870899a9c47be112acd4e32518bcfde340ba2 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 7 Jun 2024 09:18:44 -0300 Subject: [PATCH 07/15] Add derivative! and value_and_derivative! methods --- .../onearg.jl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl index ad4c2460b..90d66dcda 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl @@ -71,6 +71,10 @@ function DI.derivative(f::F, ::AutoForwardDiff, x, ::NoDerivativeExtras) where { return derivative(f, x) end +function DI.derivative!(f::F, der, ::AutoForwardDiff, x, ::NoDerivativeExtras) where {F} + return derivative!(der, f, x) +end + function DI.value_and_derivative( f::F, backend::AutoForwardDiff, x, ::NoDerivativeExtras ) where {F} @@ -79,6 +83,15 @@ function DI.value_and_derivative( return myvalue(T, ydual), myderivative(T, ydual) end +function DI.value_and_derivative!( + f::F, der, ::AutoForwardDiff, x, ::NoDerivativeExtras +) where {F} + T = tag_type(f, backend, x) + xdual = make_dual(T, x, one(x)) + ydual = f(xdual) + return myvalue(T, ydual), myderivative!(T, der, ydual) +end + function DI.value_derivative_and_second_derivative( f::F, backend::AutoForwardDiff, x, ::NoDerivativeExtras ) where {F} From 20ff3cabb8173c0fccfb87687817507991ecb609 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 7 Jun 2024 09:55:43 -0300 Subject: [PATCH 08/15] Fixup --- .../ext/DifferentiationInterfaceForwardDiffExt/onearg.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl index 90d66dcda..2e9145db4 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl @@ -84,7 +84,7 @@ function DI.value_and_derivative( end function DI.value_and_derivative!( - f::F, der, ::AutoForwardDiff, x, ::NoDerivativeExtras + f::F, der, backend::AutoForwardDiff, x, ::NoDerivativeExtras ) where {F} T = tag_type(f, backend, x) xdual = make_dual(T, x, one(x)) From 2990ff3e1532e443e7d7e0f33bb3f6118b71abd4 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 7 Jun 2024 09:57:33 -0300 Subject: [PATCH 09/15] Drop derivative and derivative! --- .../ext/DifferentiationInterfaceForwardDiffExt/onearg.jl | 8 -------- 1 file changed, 8 deletions(-) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl index 2e9145db4..3aff8d9a8 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl @@ -67,14 +67,6 @@ function DI.prepare_derivative(f::F, backend::AutoForwardDiff, x) where {F} return NoDerivativeExtras() end -function DI.derivative(f::F, ::AutoForwardDiff, x, ::NoDerivativeExtras) where {F} - return derivative(f, x) -end - -function DI.derivative!(f::F, der, ::AutoForwardDiff, x, ::NoDerivativeExtras) where {F} - return derivative!(der, f, x) -end - function DI.value_and_derivative( f::F, backend::AutoForwardDiff, x, ::NoDerivativeExtras ) where {F} From 157807f0dffabd92208a9d679455252624a85593 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 7 Jun 2024 10:03:54 -0300 Subject: [PATCH 10/15] Add prepare_second_derivative and value_derivative_and_second_derivative! --- .../onearg.jl | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl index 3aff8d9a8..b23f6198b 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl @@ -84,17 +84,36 @@ function DI.value_and_derivative!( return myvalue(T, ydual), myderivative!(T, der, ydual) end +## Second derivative + +function DI.prepare_second_derivative(f::F, backend::AutoForwardDiff, x) where {F} + return NoSecondDerivativeExtras() +end + function DI.value_derivative_and_second_derivative( - f::F, backend::AutoForwardDiff, x, ::NoDerivativeExtras + f::F, backend::AutoForwardDiff, x, ::NoSecondDerivativeExtras +) where {F} + T = tag_type(f, backend, x) + xdual = make_dual(T, x, one(x)) + T2 = tag_type(f, backend, xdual) + ydual = f(make_dual(T2, xdual, one(xdual))) + y = myvalue(T, myvalue(T2, ydual)) + der = myderivative(T, myvalue(T2, ydual)) + der2 = myderivative(T, myderivative(T2, ydual)) + return y, der, der2 +end + +function DI.value_derivative_and_second_derivative!( + f::F, der, der2, backend::AutoForwardDiff, x, ::NoSecondDerivativeExtras ) where {F} T = tag_type(f, backend, x) xdual = make_dual(T, x, one(x)) T2 = tag_type(f, backend, xdual) ydual = f(make_dual(T2, xdual, one(xdual))) - v = myvalue(T, myvalue(T2, ydual)) - d = myderivative(T, myvalue(T2, ydual)) - d2 = myderivative(T, myderivative(T2, ydual)) - return v, d, d2 + y = myvalue(T, myvalue(T2, ydual)) + myderivative!(T, der, myvalue(T2, ydual)) + myderivative!(T, der2, myderivative(T2, ydual)) + return y, der, der2 end ## Gradient From 5ce911985a3c88c2bc1a3630dc5d595252b026c4 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 7 Jun 2024 10:12:27 -0300 Subject: [PATCH 11/15] Fixup --- .../DifferentiationInterfaceForwardDiffExt.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/DifferentiationInterfaceForwardDiffExt.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/DifferentiationInterfaceForwardDiffExt.jl index f041d0331..1f52ad2b9 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/DifferentiationInterfaceForwardDiffExt.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/DifferentiationInterfaceForwardDiffExt.jl @@ -10,6 +10,7 @@ using DifferentiationInterface: HessianExtras, JacobianExtras, NoDerivativeExtras, + NoSecondDerivativeExtras, PushforwardExtras using ForwardDiff.DiffResults: DiffResults, DiffResult, GradientResult, MutableDiffResult using ForwardDiff: From 3cfbc6a58e179f477de4388925f1e23689f9bc03 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 7 Jun 2024 10:15:55 -0300 Subject: [PATCH 12/15] Drop derivative stuff --- .../onearg.jl | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl index b23f6198b..bbc79694d 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl @@ -61,29 +61,6 @@ function DI.pushforward!( return dy end -## Derivative - -function DI.prepare_derivative(f::F, backend::AutoForwardDiff, x) where {F} - return NoDerivativeExtras() -end - -function DI.value_and_derivative( - f::F, backend::AutoForwardDiff, x, ::NoDerivativeExtras -) where {F} - T = tag_type(f, backend, x) - ydual = f(make_dual(T, x, one(x))) - return myvalue(T, ydual), myderivative(T, ydual) -end - -function DI.value_and_derivative!( - f::F, der, backend::AutoForwardDiff, x, ::NoDerivativeExtras -) where {F} - T = tag_type(f, backend, x) - xdual = make_dual(T, x, one(x)) - ydual = f(xdual) - return myvalue(T, ydual), myderivative!(T, der, ydual) -end - ## Second derivative function DI.prepare_second_derivative(f::F, backend::AutoForwardDiff, x) where {F} From be143d5535feb72bb1b0c51513927d527bf24813 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 7 Jun 2024 10:41:24 -0300 Subject: [PATCH 13/15] Add second_derivative and second_derivative! methods --- .../onearg.jl | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl index bbc79694d..c799e95a2 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl @@ -67,6 +67,26 @@ function DI.prepare_second_derivative(f::F, backend::AutoForwardDiff, x) where { return NoSecondDerivativeExtras() end +function DI.second_derivative( + f::F, ::AutoForwardDiff, x, dx, ::NoSecondDerivativeExtras +) where {F} + T = tag_type(f, backend, x) + xdual = make_dual(T, x, one(x)) + T2 = tag_type(f, backend, xdual) + ydual = f(make_dual(T2, xdual, one(xdual))) + return myderivative(T, myderivative(T2, ydual)) +end + +function DI.second_derivative!( + f::F, der2, ::AutoForwardDiff, x, dx, ::NoSecondDerivativeExtras +) where {F} + T = tag_type(f, backend, x) + xdual = make_dual(T, x, one(x)) + T2 = tag_type(f, backend, xdual) + ydual = f(make_dual(T2, xdual, one(xdual))) + return myderivative!(T, der2, myderivative(T2, ydual)) +end + function DI.value_derivative_and_second_derivative( f::F, backend::AutoForwardDiff, x, ::NoSecondDerivativeExtras ) where {F} From 30c9c86d05abe061b4c08e7f9dd312181d3e33fe Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 7 Jun 2024 11:07:42 -0300 Subject: [PATCH 14/15] Fixup --- .../ext/DifferentiationInterfaceForwardDiffExt/onearg.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl index c799e95a2..3bac0f278 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl @@ -68,7 +68,7 @@ function DI.prepare_second_derivative(f::F, backend::AutoForwardDiff, x) where { end function DI.second_derivative( - f::F, ::AutoForwardDiff, x, dx, ::NoSecondDerivativeExtras + f::F, ::AutoForwardDiff, x, ::NoSecondDerivativeExtras ) where {F} T = tag_type(f, backend, x) xdual = make_dual(T, x, one(x)) @@ -78,7 +78,7 @@ function DI.second_derivative( end function DI.second_derivative!( - f::F, der2, ::AutoForwardDiff, x, dx, ::NoSecondDerivativeExtras + f::F, der2, ::AutoForwardDiff, x, ::NoSecondDerivativeExtras ) where {F} T = tag_type(f, backend, x) xdual = make_dual(T, x, one(x)) From 07ccb26a66fc616c70e1f85aecb555c029feeea3 Mon Sep 17 00:00:00 2001 From: Gabriel Gerlero Date: Fri, 7 Jun 2024 11:18:18 -0300 Subject: [PATCH 15/15] Fixup 2 --- .../ext/DifferentiationInterfaceForwardDiffExt/onearg.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl index 3bac0f278..854429acd 100644 --- a/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl +++ b/DifferentiationInterface/ext/DifferentiationInterfaceForwardDiffExt/onearg.jl @@ -68,7 +68,7 @@ function DI.prepare_second_derivative(f::F, backend::AutoForwardDiff, x) where { end function DI.second_derivative( - f::F, ::AutoForwardDiff, x, ::NoSecondDerivativeExtras + f::F, backend::AutoForwardDiff, x, ::NoSecondDerivativeExtras ) where {F} T = tag_type(f, backend, x) xdual = make_dual(T, x, one(x)) @@ -78,7 +78,7 @@ function DI.second_derivative( end function DI.second_derivative!( - f::F, der2, ::AutoForwardDiff, x, ::NoSecondDerivativeExtras + f::F, der2, backend::AutoForwardDiff, x, ::NoSecondDerivativeExtras ) where {F} T = tag_type(f, backend, x) xdual = make_dual(T, x, one(x))