importjaximportjax.numpyasjnpdefslow_f(x):# Element-wise ops see a large benefit from fusionreturnx*x+x*2.0x=jnp.ones((5000,5000))fast_f=jax.jit(slow_f)%timeit-n10-r3fast_f(x)%timeit-n10-r3slow_f(x) Usingjax.jitconstrains the kind of Python control flow the function can use; ...
importjaximportjax.numpyasjnpdefslow_f(x):# Element-wise ops see a large benefit from fusionreturnx*x+x*2.0x=jnp.ones((5000,5000))fast_f=jax.jit(slow_f)%timeit-n10-r3fast_f(x)%timeit-n10-r3slow_f(x) Usingjax.jitconstrains the kind of Python control flow the function can use; ...