Compute the gradient of a scalar-valued function f with respect to its
first argument.
Pass in different argnums to differentiate with respect to other
arguments. If a tuple is provided, the return value will be a tuple of
gradients corresponding to each argument index.
When { hasAux: true } is passed, the function f is expected to return a
[out, aux] tuple, and the return value will be [gradient, aux].
Compute the gradient of a scalar-valued function
fwith respect to its first argument.Pass in different
argnumsto differentiate with respect to other arguments. If a tuple is provided, the return value will be a tuple of gradients corresponding to each argument index.When
{ hasAux: true }is passed, the functionfis expected to return a[out, aux]tuple, and the return value will be[gradient, aux].