-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7849fc0
commit 1ed46db
Showing
2 changed files
with
3 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
struct ZygoteDiffBackend <: AbstractDiffBackend end | ||
|
||
function Manifolds._gradient(f, p, ::ZygoteDiffBackend) | ||
return Zygote.gradient(f, p) | ||
return Zygote.gradient(f, p)[1] | ||
end | ||
|
||
function Manifolds._gradient!(f, X, p, ::ZygoteDiffBackend) | ||
return Zygote.gradient!(X, f, p) | ||
return copyto!(X, Zygote.gradient(f, p)[1]) | ||
end | ||
|
||
push!(Manifolds._diff_backends, ZygoteDiffBackend()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters