Skip to content

Commit 3caef5e

Browse files
authored
Check hessian with size 2 (#191)
1 parent 5fe0965 commit 3caef5e

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

DifferentiationInterface/src/check.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Check whether `backend` supports second order differentiation by trying to compu
2828
"""
2929
function check_hessian(backend::AbstractADType)
3030
try
31-
x = [3.0]
31+
x = [1.0, 3.0]
3232
hess = hessian(sqnorm, backend, x)
33-
return isapprox(hess, [2.0;;]; rtol=1e-3)
33+
return isapprox(hess, [2.0 0.0; 0.0 2.0]; rtol=1e-3)
3434
catch exception
3535
@warn "Backend $backend does not support hessian" exception
3636
return false

DifferentiationInterface/test/second_order.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ mixed_second_order_backends = [
2828
for backend in vcat(
2929
dense_second_order_backends, sparse_second_order_backends, mixed_second_order_backends
3030
)
31-
check_hessian(backend)
31+
@test check_hessian(backend)
3232
end
3333

3434
test_differentiation(

0 commit comments

Comments
 (0)