We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b642a9f commit 7eb435bCopy full SHA for 7eb435b
1 file changed
src/extra_rules.jl
@@ -178,6 +178,7 @@ function ChainRules.frule((_, ∂x), ::Type{SArray{S, T, N, L}}, x::NTuple{L,T})
178
end
179
180
Base.view(t::Tangent{T}, inds) where T<:SVector = view(T(ChainRulesCore.backing(t.data)), inds)
181
+Base.getindex(t::Tangent{<:SVector, <:NamedTuple}, ind::Int) = ChainRulesCore.backing(t.data)[ind]
182
183
function ChainRules.frule((_, ∂x), ::Type{SArray{S, T, N, L}}, x::NTuple{L,Any}) where {S, T, N, L}
184
SArray{S, T, N, L}(x), SArray{S}(∂x)
0 commit comments