pinnx.grad module

pinnx.grad module#

This module provides automatic differentiation utilities for computing gradients, Jacobians, and Hessians of neural network outputs with respect to inputs. These are essential for evaluating PDE residuals.

Differentiation Functions#

jacobian: Computes the Jacobian matrix (first derivatives) of network outputs with respect to inputs.

hessian: Computes the Hessian matrix (second derivatives) of network outputs with respect to inputs.

gradient: Computes gradients using JAX’s automatic differentiation.

jacobian

Compute Jacobian matrix J as J[i, j] = dy_i / dx_j, where i = 0, ..., dim_y - 1 and j = 0, ..., dim_x - 1.

hessian

Compute Hessian matrix H as H[i, j] = d^2y / dx_i dx_j, where i,j = 0, ..., dim_x - 1.

gradient

Compute the gradient dy/dx of a function y = f(x) with respect to x.