flâneur — a map of the web's best reading

Just In Time Compilation with JAX — JAX documentation

jax.readthedocs.io · 810 words · saved by 1 readers

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