-
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
890: Add `jacobian`, at last? r=CarloLucibello a=mcabbott This adds a Jacobian function. Compared to #747 this one: * has tests * accepts multiple arguments * shouldn't fail if `back` returns `nothing` * inserts `vec` a few more places * has a method which accepts implicit `Params`, and returns `Grads`. (This was the only part I actually needed in real life.) * now works on the GPU too! Compared to #414 this one: * always inserts `vec`, never makes higher-dimensional arrays * runs on current Zygote * has tests. Compared to #235 this one: * doesn't try to provide numerical jacobian * doesn't alter testing infrastructure * doesn't provide `jacobian!`, nor any code for structured matrices. This does not address #564's concerns about functions which return a tuple of arrays. Only functions returning an array (or a scalar) are permitted. Similar considerations might give sensible jacobians when the argument of a function is a tuple, or some other struct, but for now these are handled by putting up a giant warning sign. Nothing in the file `utils.jl` seems to have any tests at all. So I also added tests for `hessian`. And, while I was there, made `hessian` actually accept a real number like its docstring promises. (Hence this closes #891.) And, made a version that is reverse-over-reverse, using this `jacobian`, which works less well of course but may as well exist to test things. (See for example #865.) Ideally there would be a pure-Zygote version using its own forward mode, but I didn't write that. Fixes #51, fixes #98, fixes #413. Closes #747. Co-authored-by: Michael Abbott <me@escbook> Co-authored-by: Michael Abbott <[email protected]>
- Loading branch information
Showing
8 changed files
with
290 additions
and
31 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
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
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
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
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
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
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
Oops, something went wrong.