@@ -21,7 +21,7 @@ function _make_jvp_call(fdm, f, y, xs, ẋs, ignores)
2121 ignores = collect (ignores)
2222 all (ignores) && return ntuple (_ -> NoTangent (), length (xs))
2323 sigargs = zip (xs[.! ignores], ẋs[.! ignores])
24- return _maybe_fix_to_composite (y, jvp (fdm, f2, sigargs... ))
24+ return ProjectTo (y)( jvp (fdm, f2, sigargs... ))
2525end
2626
2727"""
@@ -52,7 +52,7 @@ function _make_j′vp_call(fdm, f, ȳ, xs, ignores)
5252 @assert length (fd) == length (arginds)
5353
5454 for (dx, ind) in zip (fd, arginds)
55- args[ind] = _maybe_fix_to_composite (xs[ind], dx)
55+ args[ind] = ProjectTo (xs[ind])( dx)
5656 end
5757 return (args... ,)
5858end
@@ -87,15 +87,3 @@ function _wrap_function(f, xs, ignores)
8787 end
8888 return fnew
8989end
90-
91- # TODO : remove after https://github.com/JuliaDiff/FiniteDifferences.jl/issues/97
92- # For functions which return a tuple, FD returns a tuple to represent the differential. Tuple
93- # is not a natural differential, because it doesn't overload +, so make it a Tangent.
94- _maybe_fix_to_composite (:: P , x:: Tuple ) where {P} = Tangent {P} (x... )
95- _maybe_fix_to_composite (:: P , x:: NamedTuple ) where {P} = Tangent {P} (; x... )
96- function _maybe_fix_to_composite (
97- y:: AbstractArray , x:: AbstractArray{<:Union{Tuple,NamedTuple}}
98- )
99- return map (_maybe_fix_to_composite, y, x)
100- end
101- _maybe_fix_to_composite (:: Any , x) = x
0 commit comments