Skip to content

Commit aeba6fb

Browse files
add literal getproperty adjoint to ArrayPartition
1 parent 2c2923e commit aeba6fb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/zygote.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,10 @@ end
3131
ZygoteRules.@adjoint function DiffEqArray(u,t)
3232
DiffEqArray(u,t),y -> ([y[ntuple(x->Colon(),ndims(y)-1)...,i] for i in 1:size(y)[end]],nothing)
3333
end
34+
35+
ZygoteRules.@adjoint function ZygoteRules.literal_getproperty(A::ArrayPartition, ::Val{:x})
36+
function literal_ArrayPartition_x_adjoint(d)
37+
(ArrayPartition((isnothing(d[i]) ? zero(A.x[i]) : d[i] for i in 1:length(d))...),)
38+
end
39+
A.x,literal_ArrayPartition_x_adjoint
40+
end

0 commit comments

Comments
 (0)