From c7a4624092d90b6d49d5701967982226231d4478 Mon Sep 17 00:00:00 2001 From: "Tamas K. Papp" Date: Thu, 25 May 2023 12:30:10 +0200 Subject: [PATCH] =?UTF-8?q?Document=20that=20grad=20and=20j=E2=80=B2vp=20r?= =?UTF-8?q?eturn=20tuples.=20(#220)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Document that grad and j′vp return tuples. Fixes #219. * bump patch version --- Project.toml | 2 +- src/grad.jl | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 5c44483..895a671 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "FiniteDifferences" uuid = "26cc04aa-876d-5657-8c51-4c34ba976000" -version = "0.12.26" +version = "0.12.27" [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" diff --git a/src/grad.jl b/src/grad.jl index d7d15ac..316d6ab 100644 --- a/src/grad.jl +++ b/src/grad.jl @@ -66,6 +66,8 @@ end j′vp(fdm, f, ȳ, x...) Compute an adjoint with any types of arguments `x` for which [`to_vec`](@ref) is defined. + +Return tuple of gradients, one for each argument. """ function j′vp(fdm, f, ȳ, x) x_vec, vec_to_x = to_vec(x) @@ -84,5 +86,7 @@ end grad(fdm, f, xs...) Compute the gradient of `f` for any `xs` for which [`to_vec`](@ref) is defined. + +Return tuple of gradients, one for each argument. """ grad(fdm, f, xs...) = j′vp(fdm, f, 1, xs...) # `j′vp` with seed of 1