Skip to content

Commit

Permalink
fixup! fix: fix view adjoints
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed May 30, 2024
1 parent fc037f9 commit 97edb58
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ext/RecursiveArrayToolsZygoteExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ end
adj = let VA = VA
function Array_adjoint(y)
VA = recursivecopy(VA)
copyto!(VA, y)
VA .= y

Check warning on line 118 in ext/RecursiveArrayToolsZygoteExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/RecursiveArrayToolsZygoteExt.jl#L118

Added line #L118 was not covered by tests
return (VA,)
end
end
Expand All @@ -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)...)

Check warning on line 130 in ext/RecursiveArrayToolsZygoteExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/RecursiveArrayToolsZygoteExt.jl#L126-L130

Added lines #L126 - L130 were not covered by tests
end
end
Expand All @@ -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)...)

Check warning on line 143 in ext/RecursiveArrayToolsZygoteExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/RecursiveArrayToolsZygoteExt.jl#L137-L143

Added lines #L137 - L143 were not covered by tests
end
end
Expand Down

0 comments on commit 97edb58

Please sign in to comment.