pub fn vjp<'a, F>(
f: F,
primals: &[Array],
cotangents: &[Array],
) -> Result<(Vec<Array>, Vec<Array>)>
Expand description
Compute the vector-Jacobian product.
Computes the product of the cotangents
with the Jacobian of a function f
evaluated at
primals
.
§Params:
- f: function which takes an array of
Array
and returns an array ofArray
- primals: array of
Array
at which to evaluate the Jacobian - cotangents: array of
Array
which are the “vector” in the vector-Jacobian product. Thecotangents
should be the same in number, shape and type as the outputs off
§Returns:
array of the vector-Jacobian products which is the same in number, shape and type of the outputs
of f