You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# see discussion at https://github.com/JuliaDiff/ChainRulesCore.jl/pull/626#discussion_r1345235265
124
+
y =Array{guess_zero_tangent_type(P), N}(undef, size(x)...)
125
+
@inboundsfor n ineachindex(y)
126
+
ifisassigned(x, n)
127
+
y[n] =zero_tangent(x[n])
128
+
end
129
+
end
130
+
return y
131
+
end
132
+
133
+
guess_zero_tangent_type(::Type{T}) where {T<:Number} = T
134
+
guess_zero_tangent_type(::Type{<:Array{T,N}}) where {T,N} = Array{guess_zero_tangent_type(T), N}
135
+
guess_zero_tangent_type(::Any) = Any # if we had a general way to handle determining tangent type # https://github.com/JuliaDiff/ChainRulesCore.jl/issues/634
136
+
#TODO: we might be able to do better than this. even without.
0 commit comments