Skip to content

Commit 19e7d88

Browse files
authored
Remove duplicate code (#126)
1 parent 211b675 commit 19e7d88

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

src/AbstractDifferentiation.jl

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -161,21 +161,6 @@ function value_and_hessian(ab::AbstractBackend, f, x)
161161
return value, hess
162162
end
163163

164-
function value_and_hessian(ab::HigherOrderBackend, f, x)
165-
if x isa Tuple
166-
# only support computation of Hessian for functions with single input argument
167-
x = only(x)
168-
end
169-
170-
value = f(x)
171-
hess = jacobian(second_lowest(ab), (_x,) -> begin
172-
g = gradient(lowest(ab), f, _x)
173-
return g[1] # gradient returns a tuple
174-
end, x)
175-
176-
return value, hess
177-
end
178-
179164
"""
180165
AD.value_gradient_and_hessian(ab::AD.AbstractBackend, f, x)
181166
@@ -200,23 +185,6 @@ function value_gradient_and_hessian(ab::AbstractBackend, f, x)
200185
return value, (grads,), hess
201186
end
202187

203-
function value_gradient_and_hessian(ab::HigherOrderBackend, f, x)
204-
if x isa Tuple
205-
# only support computation of Hessian for functions with single input argument
206-
x = only(x)
207-
end
208-
209-
value = f(x)
210-
grads, hess = value_and_jacobian(
211-
second_lowest(ab), _x -> begin
212-
g = gradient(lowest(ab), f, _x)
213-
return g[1] # gradient returns a tuple
214-
end, x
215-
)
216-
217-
return value, (grads,), hess
218-
end
219-
220188
"""
221189
AD.pushforward_function(ab::AD.AbstractBackend, f, xs...)
222190

0 commit comments

Comments
 (0)