liveBook · Manning

Jax.grad

jax.grad is a JAX transformation that returns a function computing gradients of a scalar-output function with respect to its inputs.

How 2 Manning books explain it

Deep Learning with JAX

A JAX transformation that returns a derivative-computing version of a function, typically with respect to its first argument by default.

How it is used
Calculates gradients for loss functions, parameter updates, autodiff experiments, and composable numerical programs.
How deep it goes
Explains functional gradients, argnums, auxiliary outputs, nested parameters, stopping gradient flow, and higher derivatives, while deferring autodiff-mode internals.
Examples
Demonstrates linear regression, MNIST loss gradients, Minkowski distance, dictionary parameters, higher derivatives, and per-sample gradients.
What you can do after
Apply it via JAX to obtain parameter, selected-argument, nested-structure, higher-order, or per-sample gradients.

Read how Deep Learning with JAX explains jax.grad →

Deep Learning with Python, Third Edition

A JAX function that creates a gradient-computing function for differentiable inputs and outputs.

How it is used
Computes gradients for loss functions used in array programs, model training, and input-image optimization.
How deep it goes
Explains function transformation, scalar-loss constraints, argument conventions, auxiliary outputs, and a worked example without deriving automatic differentiation internals.
Examples
Uses a squared scalar loss, structured model state, auxiliary outputs, and stochastic gradient ascent on an input image.
What you can do after
Apply it via JAX to create reusable gradient functions for scalar losses and use them in optimization steps.

Read how Deep Learning with Python, Third Edition explains jax.grad →

Also covered in

What to know first

Related concepts

Questions about jax.grad

What is jax.grad?

jax.grad is a JAX transformation that returns a function computing gradients of a scalar-output function with respect to its inputs.

Which Manning books explain jax.grad?

Deep Learning with JAX and Deep Learning with Python, Third Edition.

What should I know before learning jax.grad?

Manning books that teach jax.grad usually introduce gradient, objective function, function and digital image first.

What is the difference between jax.grad and jax.value_and_grad?

jax.grad is a JAX transformation that returns a function computing gradients of a scalar-output function with respect to its inputs. jax.value_and_grad is a JAX transformation that creates a function returning both a scalar function’s value and its gradient.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.