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
128
+
y =Array{guess_zero_tangent_type(P), N}(undef, size(x)...)
129
+
@inboundsfor n ineachindex(y)
130
+
ifisassigned(x, n)
131
+
y[n] =zero_tangent(x[n])
132
+
end
133
+
end
134
+
return y
135
+
end
136
+
137
+
guess_zero_tangent_type(::Type{T}) where {T<:Number} = T
138
+
guess_zero_tangent_type(::Type{<:Array{T,N}}) where {T,N} = Array{guess_zero_tangent_type(T), N}
139
+
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
140
+
#TODO: we might be able to do better than this. even without.
0 commit comments