You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 594aeac
Browse filesBrowse the repository at this point in the historyBrowse files
Fix grammar and add Wikipedia links to jax_intro.md (#445)
- Fix spelling: 'parallize' → 'parallelize'
- Fix grammar: 'target JAX' → 'targets JAX'
- Fix grammar: remove extra 'is' in 'JAX is as a drop-in'
- Fix grammar: add missing 'is' in 'full control of random state'
- Add Wikipedia links for NumPy, SciPy, automatic differentiation, functional programming, pure functions, deterministic, and side effects
- Add link to JAX scipy documentation
- Add cross-reference link to Numba exercise using {ref}
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <[email protected]>
Copy file name to clipboardExpand all lines: lectures/jax_intro.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,15 +15,15 @@ kernelspec:
15
15
16
16
This lecture provides a short introduction to [Google JAX](https://github.com/jax-ml/jax).
17
17
18
-
JAX is a high-performance scientific computing library that provides
18
+
JAX is a high-performance scientific computing library that provides
19
19
20
-
* a NumPy-like interface that can automatically parallize across CPUs and GPUs,
20
+
* a [NumPy](https://en.wikipedia.org/wiki/NumPy)-like interface that can automatically parallelize across CPUs and GPUs,
21
21
* a just-in-time compiler for accelerating a large range of numerical
Increasingly, JAX also maintains and provides more specialized scientific
26
-
computing routines, such as those originally found in SciPy.
25
+
Increasingly, JAX also maintains and provides [more specialized scientific
26
+
computing routines](https://docs.jax.dev/en/latest/jax.scipy.html), such as those originally found in [SciPy](https://en.wikipedia.org/wiki/SciPy).
27
27
28
28
In addition to what's in Anaconda, this lecture will need the following libraries:
29
29
@@ -36,7 +36,7 @@ In addition to what's in Anaconda, this lecture will need the following librarie
36
36
```{admonition} GPU
37
37
:class: warning
38
38
39
-
This lecture is accelerated via [hardware](status:machine-details) that has access to a GPU and target JAX for GPU programming.
39
+
This lecture is accelerated via [hardware](status:machine-details) that has access to a GPU and targets JAX for GPU programming.
40
40
41
41
Free GPUs are available on Google Colab.
42
42
To use this option, please click on the play icon top right, select Colab, and set the runtime environment to include a GPU.
@@ -50,7 +50,7 @@ If you would like to install JAX running on the `cpu` only you can use `pip inst
50
50
One of the attractive features of JAX is that, whenever possible, its array
51
51
processing operations conform to the NumPy API.
52
52
53
-
This means that, in many cases, we can use JAX is as a drop-in NumPy replacement.
53
+
This means that, in many cases, we can use JAX as a drop-in NumPy replacement.
54
54
55
55
Let's look at the similarities and differences between JAX and NumPy.
56
56
@@ -199,7 +199,7 @@ a, a_new
199
199
```
200
200
201
201
The designers of JAX chose to make arrays immutable because JAX uses a
This design choice has important implications, which we explore next!
205
205
@@ -241,19 +241,19 @@ In other words, JAX assumes a functional programming style.
241
241
242
242
The major implication is that JAX functions should be pure.
243
243
244
-
**Pure functions** have the following characteristics:
244
+
[Pure functions](https://en.wikipedia.org/wiki/Pure_function) have the following characteristics:
245
245
246
246
1.*Deterministic*
247
247
2.*No side effects*
248
248
249
-
**Deterministic** means
249
+
[Deterministic](https://en.wikipedia.org/wiki/Deterministic_algorithm) means
250
250
251
251
* Same input $\implies$ same output
252
252
* Outputs do not depend on global state
253
253
254
254
In particular, pure functions will always return the same result if invoked with the same inputs.
255
255
256
-
**No side effects** means that the function
256
+
[No side effects](https://en.wikipedia.org/wiki/Side_effect_(computer_science)) means that the function
257
257
258
258
* Won't change global state
259
259
* Won't modify data passed to the function (immutable data)
@@ -307,7 +307,7 @@ At first you might find the syntax rather verbose.
307
307
But you will soon realize that the syntax and semantics are necessary in order
308
308
to maintain the functional programming style we just discussed.
309
309
310
-
Moreover, full control of random state
310
+
Moreover, full control of random state is
311
311
essential for parallel programming, such as when we want to run independent experiments along multiple threads.
312
312
313
313
@@ -793,8 +793,8 @@ We defer further exploration of automatic differentiation with JAX until {doc}`j
793
793
:label: jax_intro_ex2
794
794
```
795
795
796
-
In the Exercise section of {doc}`our lecture on Numba <numba>`, we used Monte
797
-
Carlo to price a European call option.
796
+
In the Exercise section of {doc}`our lecture on Numba <numba>`, we {ref}`used Monte
797
+
Carlo to price a European call option <numba_ex4>`.
798
798
799
799
The code was accelerated by Numba-based multithreading.
0 commit comments