From 97edb5870e6a506e823210ce59e9f93e434b0dc1 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Thu, 30 May 2024 12:12:16 +0530 Subject: [PATCH] fixup! fix: fix view adjoints --- ext/RecursiveArrayToolsZygoteExt.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ext/RecursiveArrayToolsZygoteExt.jl b/ext/RecursiveArrayToolsZygoteExt.jl index c67103cb..e668676f 100644 --- a/ext/RecursiveArrayToolsZygoteExt.jl +++ b/ext/RecursiveArrayToolsZygoteExt.jl @@ -115,7 +115,7 @@ end adj = let VA = VA function Array_adjoint(y) VA = recursivecopy(VA) - copyto!(VA, y) + VA .= y return (VA,) end end @@ -126,7 +126,7 @@ end view_adjoint = let A = A, I = I function (y) A = recursivecopy(A) - copyto!(A, y) + A .= y (A, map(_ -> nothing, I)...) end end @@ -138,7 +138,8 @@ end function (y) A = recursivecopy(A) recursivefill!(A, zero(eltype(A))) - A[I...] .= y + v = view(A, I...) + v .= y return (A, map(_ -> nothing, I)...) end end