-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# is JAX cool ? | ||
|
||
Python is slow, and don't get me started on how it "call C". | ||
Even numpy is slow (except for slow computations, then it's relatively fast). | ||
|
||
Is JAX cool ? Does it "make Python fast" ? | ||
Perhaps. | ||
|
||
It can be a straight-up replacement for numpy, but faster (on GPU, TPU, or CPU fallback). | ||
|
||
## Testing stuff | ||
|
||
```Python | ||
|
||
import jax.numpy as jnp | ||
from jax import grad, jit, vmap | ||
from jax import random | ||
import matplotlib.pyplot as plt | ||
|
||
%matplotlib inline | ||
|
||
x = jnp.arange(0,2*jnp.pi,0.1) # start,stop,step | ||
|
||
for j in range(20): | ||
y = 0 | ||
for i in range(1,j,2): | ||
y += jnp.sin(x*i)/i | ||
plt.plot(x,y) | ||
plt.show() | ||
|
||
``` | ||
|
||
To be honest, it's not a good benchmark to compare with numpy. | ||
I'm just putting it here because i always forget how to make square waves from sin (Fourier series). | ||
|
||
But it look like numpy, so it's cool. | ||
|
||
![squareFFT.png](squareFFT.png) | ||
|
||
There is probably a more JNX-ish wat to do it, but how ? Ask Copilot chat ? | ||
|
||
Copilot is still using loops. Perhaps it's how it's done in JAX. | ||
|
||
I'll need to try some other examples. Perhaps Fractals, or Fractals. | ||
|
||
## Hello mandelbrot | ||
|