Defines Zygote adjoint rules for StructArrays.
Install with ] add ZygoteStructArrays
. Then simply import ZygoteStructArrays
and the adjoint rules will just work.
Try to run the following code (without loading this package first):
using Zygote, StructArrays
gradient(randn(2), randn(2)) do X,Y
S = StructArray{Complex}((X,Y))
sum(S).re + 2sum(S).im
end
You will get an error. Now load this package and run that again.