pub fn value_and_grad(f: &Function, wrt: &[bool]) -> Result<Function>Expand description
A function that returns the outputs of f and the gradient of its first
output (a float scalar, the loss) with respect to the inputs marked
wrt: value_and_grad. The other outputs are auxiliary values, as with
JAX’s has_aux, and are not differentiated.
§Errors
Returns an error if the first output of f is not a float scalar, or as
vjp.