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
Arrayand returns an array ofArray - primals: array of
Arrayat which to evaluate the Jacobian - cotangents: array of
Arraywhich are the “vector” in the vector-Jacobian product. Thecotangentsshould 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