mlx.core.vjp#
- mlx.core.vjp(fun: function, primals: List[array], cotangents: List[array]) Tuple[List[array], List[array]]#
Compute the vector-Jacobian product.
Computes the product of the
cotangentswith the Jacobian of a functionfunevaluated atprimals.- Parameters:
fun (function) – A function which takes a variable number of
arrayand returns a singlearrayor list ofarray.primals (list(array)) – A list of
arrayat which to evaluate the Jacobian.cotangents (list(array)) – A list of
arraywhich are the “vector” in the vector-Jacobian product. Thecotangentsshould be the same in number, shape, and type as the outputs offun.
- Returns:
A list of the vector-Jacobian products which is the same in number, shape, and type of the outputs of
fun.- Return type: