We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
do you think it is conceivable to implement type checks for generics, e.g. generic array types or generic data types, see below.
from jaxtyping import jaxtyped from beartype import beartype from jax import Array as JaxArray from torch import Tensor as TorchArray from numpy import ndarray as NumpyArray GenericArray = TypeVar("GenericArray", JaxArray, NumpyArray, TorchArray) GenericFloat = TypeVar("GenericFloat", Float16, Float32, Float64) @jaxtyped @beartype def f(a: Shaped[GenericArray, "n"]) -> Shaped[GenericArray, "n"]: return a @jaxtyped @beartype def f(a: GenericFloat[NumpyArray, "n"]) -> GenericFloat[NumpyArray, "n"]: return a
I would be happy to contribute, but I am unsure if there is even a possiblity of success.
The text was updated successfully, but these errors were encountered:
Yup, I think this should be possible! I'd be happy to take a PR on this.
Sorry, something went wrong.
No branches or pull requests
Hi,
do you think it is conceivable to implement type checks for generics, e.g. generic array types or generic data types, see below.
I would be happy to contribute, but I am unsure if there is even a possiblity of success.
The text was updated successfully, but these errors were encountered: