Last active
June 11, 2024 10:49
-
-
Save dvruette/f24fe0bcfa4fbb38773211733f27e3d5 to your computer and use it in GitHub Desktop.
ada_numpy.py
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
from contextlib import contextmanager | |
@contextmanager | |
def set_numpy(name): | |
if name == "numpy": | |
import numpy as np | |
yield np | |
elif name == "jax": | |
import jax.numpy as jnp | |
yield jnp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment