JAX As Accelerated NumPy — JAX documentation
Fundamentally, JAX is a library that enables transformations of array-manipulating programs written with a NumPy-like API. Over the course of this series of guides, we will unpack exactly what that means. For now, you can think of JAX as differentiable NumPy that runs on accelerators. The code below shows how to import JAX and create a vector. So far, everything is just like NumPy. A big appeal of JAX is that you don’t need to learn a new API. Many common NumPy programs would run just as well in JAX if you substitute np for jnp. However, there are some important differences which we touch on at the end of this section. You can notice the first difference if you check the type of x. It is a variable of type DeviceArray, which is the way JAX represents arrays. One useful feature of JAX is that the same code can be run on different backends – CPU, GPU and TPU. We will now perform a dot product to demonstrate that it can be done in different devices without changing the code. We use %timei
; } .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
related reading
- How to think in JAX — JAX documentationdocs.jax.dev
- GitHub - jax-ml/jax: Composable transformations of Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU, and moregithub.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
- Key concepts — JAX documentationjax.readthedocs.io
- Just In Time Compilation with JAX — JAX documentationjax.readthedocs.io
- JAX core from scratch — JAX documentationdocs.jax.dev
- Why You Should (or Shouldn't) be Using Google's JAX in 2023assemblyai.com
- 🔪 JAX - The Sharp Bits 🔪 — 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
- Frequently asked questions (FAQ) — JAX documentationjax.readthedocs.io