patrick-kidger/jaxtyping
Type annotations and runtime checking for shape and dtype of JAX/NumPy/PyTorch/etc. arrays. https://docs.kidger.site/jaxtyping/
What it solves
It addresses the difficulty of tracking and verifying the shapes and data types of arrays and tensors across different machine learning frameworks. In complex models, mismatching dimensions often lead to runtime errors that are hard to debug.
How it works
The library provides specialized type annotations that allow developers to specify the expected shape and data type of a tensor (e.g., Float[Tensor, "dim1 dim2"]). These annotations are compatible with runtime type-checking packages like typeguard and beartype to enforce these constraints during execution.
Who it’s for
Researchers and engineers working with JAX, PyTorch, NumPy, TensorFlow, or MLX who want to make their code more readable, maintainable, and less prone to shape-related bugs.
Highlights
- Support for multiple frameworks including JAX, PyTorch, NumPy, TensorFlow, and MLX.
- Runtime type-checking capabilities when paired with compatible libraries.
- Clear, descriptive annotations for array dimensions and axes.
Related
- Project
- Project
- Project
- Project
- Project