saiunit.autograd.jacobian#
- saiunit.autograd.jacobian(fun, argnums=0, has_aux=False, holomorphic=False, allow_int=False)[source]#
Alias of
jacrev().This is a convenience alias that delegates directly to
jacrev(). Seejacrev()for full documentation.- Parameters:
fun (
Callable) – Function whose Jacobian is to be computed.argnums (
int|Sequence[int]) – Specifies which positional argument(s) to differentiate with respect to. Default is0.has_aux (
bool) – IfTrue,funreturns(output, aux)and onlyoutputis differentiated. Default isFalse.holomorphic (
bool) – Whetherfunis promised to be holomorphic. Default isFalse.allow_int (
bool) – Whether integer-valued inputs are allowed. Default isFalse.
- Returns:
jacfun – A function that computes the Jacobian of
funthrough reverse-mode automatic differentiation.- Return type:
Examples
>>> import jax.numpy as jnp >>> import saiunit as u >>> import saiunit.autograd as suauto >>> def f(x): ... return x ** 2 >>> jac_fn = suauto.jacobian(f) >>> jac_fn(jnp.array(3.0) * u.ms) 6.0 * ms