Just In Time Compilation with JAX — JAX documentation
In this section, we will further explore how JAX works, and how we can make it performant. We will discuss the jax.jit() transform, which will perform Just In Time (JIT) compilation of a JAX Python function so it can be executed efficiently in XLA. In the previous section, we discussed that JAX allows us to transform Python functions. This is done by first converting the Python function into a simple intermediate language called jaxpr. The transformations then work on the jaxpr representation. We can show a representation of the jaxpr of a function by using jax.make_jaxpr: The Understanding Jaxprs section of the documentation provides more information on the meaning of the above output. Importantly, note how the jaxpr does not capture the side-effect of the function: there is nothing in it corresponding to global_list.append(x). This is a feature, not a bug: JAX is designed to understand side-effect-free (a.k.a. functionally pure) code. If pure function and side-effect are unfamiliar t
; } .ethical-fixedfooter .ethical-callout { color: #999; padding-left: 6px; white-space: nowrap; } .ethical-fixedfooter a, .ethical-fixedfooter a:hover, .ethical-fixedfooter a:active, .ethical-fixedfooter a:visited { color: #404040; text-decoration: none; } .ethical-fixedfooter .ethical-close { position: absolute; top: 0; right: 5px; font-size: 20px; line-height: 20px; } /* RTD Theme specific customizations */ .wy-nav-side .ethical-rtd { /* RTD theme doesn't correctly set the sidebar width */ max-width: 300px; padding: 0 1em; } .ethical-rtd .ethical-sidebar { /* RTD theme doesn't set sidebar t
Explore this link on the map →related reading
- JAX As Accelerated NumPy — JAX documentationjax.readthedocs.io
- Just-in-time compilation — JAX documentationjax.readthedocs.io
- Why You Should (or Shouldn't) be Using Google's JAX in 2023assemblyai.com
- GitHub - jax-ml/jax: Composable transformations of Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU, and more · GitHubgithub.com
- Quickstart: How to think in JAX — JAX documentationjax.readthedocs.io
- Why You Should (or Shouldn't) be Using Google's JAX in 2023assemblyai.com
- Frequently asked questions (FAQ) — JAX documentationjax.readthedocs.io
- Key concepts — JAX documentationjax.readthedocs.io
- 🔪 JAX - The Sharp Bits 🔪 — JAX documentationjax.readthedocs.io
- Introduction to debugging — JAX documentationjax.readthedocs.io
- Using JAX to accelerate our research — Google DeepMinddeepmind.com
- Build a Transformer in JAX from scratch: how to write and train your own models | AI Summertheaisummer.com