Introduction to debugging — JAX documentation
This section introduces you to a set of built-in JAX debugging methods — jax.debug.print(), jax.debug.breakpoint(), and jax.debug.callback() — that you can use with various JAX transformations. Let’s begin with jax.debug.print(). Here is a rule of thumb: Use jax.debug.print() for traced (dynamic) array values with jax.jit(), jax.vmap() and others. Use Python print() for static values, such as dtypes and array shapes. Recall from Just-in-time compilation that when transforming a function with jax.jit(), the Python code is executed with abstract tracers in place of your arrays. Because of this, the Python print() function will only print this tracer value: Python’s print executes at trace-time, before the runtime values exist. If you want to print the actual runtime values, you can use jax.debug.print(): Similarly, within jax.vmap(), using Python’s print will only print the tracer; to print the values being mapped over, use jax.debug.print(): Here’s the result with jax.lax.map(), which i
Introduction to debugging # Do you have exploding gradients? Are NaNs making you gnash your teeth? Just want to poke around the intermediate values in your computation? This section introduces you to a set of built-in JAX debugging methods that you can use with various JAX transformations. Summary: Use jax.debug.print() to print values to stdout in jax.jit -, jax.pmap -, and pjit -decorated functions, and jax.debug.breakpoint() to pause execution of your compiled function to inspect values in the call stack. jax.experimental.checkify lets you add jit -able runtime error checking (e.g. out of b
Explore this link on the map →related reading
- Quickstart: How to think in JAX — JAX documentationjax.readthedocs.io
- Just-in-time compilation — JAX documentationjax.readthedocs.io
- 🔪 JAX - The Sharp Bits 🔪 — JAX documentationjax.readthedocs.io
- Frequently asked questions (FAQ) — JAX documentationjax.readthedocs.io
- Key concepts — JAX documentationjax.readthedocs.io
- GitHub - jax-ml/jax: Composable transformations of Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU, and more · GitHubgithub.com
- Why You Should (or Shouldn't) be Using Google's JAX in 2023assemblyai.com
- jax.Array — JAX documentationjax.readthedocs.io
- Why You Should (or Shouldn't) be Using Google's JAX in 2023assemblyai.com
- Just In Time Compilation with JAX — JAX documentationjax.readthedocs.io
- JAX As Accelerated NumPy — JAX documentationjax.readthedocs.io
- Everything is Fertilenickcammarata.com