@jax.custom_jvp
def tpre(t, v, vdot):
return t
@tpre.defjvp
def tpre_jvp(primals, tangents):
t, v, vdot = primals
This file contains hidden or 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
| # pip install keystone-engine | |
| import inspect | |
| import struct | |
| from keystone import Ks, KS_ARCH_X86, KS_MODE_64 | |
| import ctypes | |
| import mmap | |
| def map_type(x): | |
| if isinstance(x, int): return 'i64' |
This file contains hidden or 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
| npx esbuild main.tsx --bundle --format=esm --outfile=dist/main.js --jsx=automatic --jsx-import-source=preact |
This file contains hidden or 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
| import jax | |
| import tqdm | |
| from jax import numpy as jnp | |
| from brax.io import mjcf | |
| from brax.envs import PipelineEnv, State | |
| from brax.io import html | |
| from brax.generalized import pipeline | |
| sys = mjcf.load('osc-mouse.xml') |
This file contains hidden or 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
| set -ex | |
| . ../env/bin/activate | |
| python3 jax_test.py | |
| iree-opt ./jax.stablehlo.mlir \ | |
| --iree-stablehlo-input-transformation-pipeline \ | |
| --convert-scf-to-cf \ | |
| > jax.linalg.mlir |
This file contains hidden or 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
| import jax | |
| import jax.numpy as jnp | |
| import matplotlib.pyplot as plt | |
| def normalize(x): | |
| return x / jnp.linalg.norm(x) | |
| def vec(x, y, z): | |
| return jnp.array([x, y, z], dtype='float32') |
This file contains hidden or 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
| import jax | |
| import jax.numpy as jnp | |
| import matplotlib.pyplot as plt | |
| import functools | |
| import typing | |
| def main(): | |
| params = IOCellParams(g_CaL=1.2) | |
| state0 = IOCellState.make(params) | |
| @jax.jit |
This file contains hidden or 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
| for model in paper_experiments/nml_standalones/*/ | |
| do | |
| echo -n "$(basename "${model}")" | |
| for fun in log exp sqrt sin cos tan sinh cosh tanh abs ceil factorial random | |
| do | |
| if rg \ | |
| -q \ | |
| -i \ | |
| -g '*.nml' \ | |
| '\b'"${fun}"'\b' \ |
This file contains hidden or 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
| 'Conv' ############################################################################################################################################################# | |
| 'MaxPool' ################################################################################################################################################# | |
| 'Relu' ############################################################################################################################################# | |
| 'Reshape' ################################################################################################################################## | |
| 'Softmax' ########################################################################################################## | |
| 'Concat' ################################################################################################## | |
| 'Add' ######################## |
NewerOlder