ChainRulesCore.jl
ChainRulesCore.jl copied to clipboard
Implement getindex and view for AbstractZero
It would be handy to add something like the following overloads:
getindex(x::AbstractZero, i..) = x
view(x::AbstractZero, i...) = x
since a Zero if interpreted as an array can only have Zero subarrays or elements. This would make it so rules that depend only on certain elements of a differential don't necessarily have to special-case to work around possible Zero arrays but can instead just index them as normal.
Agreed.
Also getproperty so it can pretend to be a struct.
Maybe also get so it can pretend to be something with keys?