We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e39fdbc commit f402f75Copy full SHA for f402f75
test/Nonlinear/ReverseAD.jl
@@ -630,6 +630,18 @@ function test_linearity()
630
return
631
end
632
633
+function test_linearity_no_hess()
634
+ x = MOI.VariableIndex(1)
635
+ model = Nonlinear.Model()
636
+ ex = Nonlinear.add_expression(model, :($x + 1))
637
+ Nonlinear.set_objective(model, ex)
638
+ evaluator = Nonlinear.Evaluator(model, Nonlinear.SparseReverseMode(), [x])
639
+ MOI.initialize(evaluator, [:Grad, :Jac])
640
+ # We initialized without the need for the hessian so
641
+ # the linearity shouldn't be computed.
642
+ @test only(evaluator.backend.subexpressions).linearity == ReverseAD.NONLINEAR
643
+end
644
+
645
function test_dual_forward()
646
x = MOI.VariableIndex(1)
647
y = MOI.VariableIndex(2)
0 commit comments