hessian#
- class pinnx.grad.hessian(fn, xs, y=None, xi=None, xj=None, vmap=True)[source]#
Compute Hessian matrix H as H[i, j] = d^2y / dx_i dx_j, where i,j = 0, …, dim_x - 1.
- Parameters:
fn (
Callable) – Function to compute the gradient.xs (
Dict) – Inputs of the function.xi (
Union[str,Sequence[str],None]) – i`th row. If `i isNone, returns the j`th column H[:, `j].xj (
Union[str,Sequence[str],None]) – j`th column. If `j isNone, returns the i`th row H[`i, :], i.e., the gradient of y_i. i and j cannot be bothNone, unless H has only one element, which is returned.
- Returns:
H[i, j].