• Stars
    star
    914
  • Rank 48,122 (Top 1.0 %)
  • Language
    Python
  • License
    Other
  • Created almost 2 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Type annotations and runtime checking for shape and dtype of JAX/NumPy/PyTorch/etc. arrays. https://docs.kidger.site/jaxtyping/

jaxtyping

Type annotations and runtime type-checking for:

  1. shape and dtype of JAX arrays; (Now also supports PyTorch, NumPy, and TensorFlow!)
  2. PyTrees.

For example:

from jaxtyping import Array, Float, PyTree

# Accepts floating-point 2D arrays with matching dimensions
def matrix_multiply(x: Float[Array, "dim1 dim2"],
                    y: Float[Array, "dim2 dim3"]
                  ) -> Float[Array, "dim1 dim3"]:
    ...

def accepts_pytree_of_ints(x: PyTree[int]):
    ...

def accepts_pytree_of_arrays(x: PyTree[Float[Array, "batch c1 c2"]]):
    ...

Installation

pip install jaxtyping

Requires Python 3.9+.

JAX is an optional dependency, required for a few JAX-specific types. If JAX is not installed then these will not be available, but you may still use jaxtyping to provide shape/dtype annotations for PyTorch/NumPy/TensorFlow/etc.

The annotations provided by jaxtyping are compatible with runtime type-checking packages, so it is common to also install one of these. The two most popular are typeguard (which exhaustively checks every argument) and beartype (which checks random pieces of arguments).

Documentation

Available at https://docs.kidger.site/jaxtyping.

Finally

See also: other libraries in the JAX ecosystem

Equinox: neural networks.

Optax: first-order gradient (SGD, Adam, ...) optimisers.

Diffrax: numerical differential equation solvers.

Lineax: linear solvers and linear least squares.

Eqxvision: computer vision models.

sympy2jax: SymPy<->JAX conversion; train symbolic expressions via gradient descent.

Disclaimer

This is not an official Google product.

More Repositories

1

equinox

Elegant easy-to-use neural networks + scientific computing in JAX. https://docs.kidger.site/equinox/
Python
1,743
star
2

torchtyping

Type annotations and dynamic checking for a tensor's shape, dtype, names, etc.
Python
1,331
star
3

diffrax

Numerical differential equation solvers in JAX. Autodifferentiable and GPU-capable. https://docs.kidger.site/diffrax/
Python
1,197
star
4

NeuralCDE

Code for "Neural Controlled Differential Equations for Irregular Time Series" (Neurips 2020 Spotlight)
Python
576
star
5

torchcde

Differentiable controlled differential equation solvers for PyTorch with GPU support and memory-efficient adjoint backpropagation.
Python
389
star
6

mkposters

Make posters from Markdown files.
Python
317
star
7

sympy2jax

Turn SymPy expressions into trainable JAX expressions.
Python
299
star
8

lineax

Linear solvers in JAX and Equinox. https://docs.kidger.site/lineax
Python
299
star
9

signatory

Differentiable computations of the signature and logsignature transforms, on both CPU and GPU. (ICLR 2021)
C++
246
star
10

optimistix

Nonlinear optimisation (root-finding, least squares, ...) in JAX+Equinox. https://docs.kidger.site/optimistix/
Python
225
star
11

torchcubicspline

Interpolating natural cubic splines. Includes batching, GPU support, support for missing values, evaluating derivatives of the spline, and backpropagation.
Python
177
star
12

sympytorch

Turning SymPy expressions into PyTorch modules.
Python
122
star
13

quax

Multiple dispatch over abstract array types in JAX.
Python
88
star
14

FasterNeuralDiffEq

Code for "'Hey, that's not an ODE:' Faster ODE Adjoints via Seminorms" (ICML 2021)
Python
84
star
15

Deep-Signature-Transforms

Code for "Deep Signature Transforms" (NeurIPS 2019)
Jupyter Notebook
82
star
16

typst_pyimage

Typst extension, adding support for generating figures using inline Python code
Python
65
star
17

generalised_shapelets

Code for "Generalised Interpretable Shapelets for Irregular Time Series"
Jupyter Notebook
51
star
18

PatModules.jl

A better import/module system for Julia.
Julia
18
star
19

action_update_python_project

Github Action to: Check version / Test / git tag / GitHub Release / Deploy to PyPI
8
star
20

exvoker

A CLI tool. Extract regexes from stdout (e.g. URLs) and invoke commands on them (e.g. open the webpage).
Rust
8
star
21

pytkdocs_tweaks

Some custom tweaks to the results produced by pytkdocs.
Python
5
star
22

Learning-Interpolation

Applying machine learning to help numerically solve the Camassa-Holm equation.
Jupyter Notebook
4
star
23

matching

Round robin matching algorithm.
Python
3
star
24

candle

Simple PyTorch helpers. (I think we've probably all written one of these for ourselves!)
Python
3
star
25

tools

Helpful abstract tools (functions, classes, ... ) for coding in Python.
Python
3
star
26

pdfscraper

Saves a webpage and all linked pdfs.
Python
3
star
27

ktools

Tools for working with Keras.
Python
2
star
28

loccounter

Counts lines of Python code.
Python
2
star
29

Dissertation

Master's Dissertation: Polynomial Approximation of Holomorphic Functions
2
star
30

py2annotate

An extension to Sphinx autodoc to augment Sphinx documentation with type annotations, when using Python 2 style type annotations.
Python
2
star
31

adventuregame

The very start of a game I was toying with before I got distracted by the PhD...
Python
2
star
32

MPE-CDT-Project

A simple machine learning project for weather observations.
Jupyter Notebook
2
star
33

tfext

Some extra stuff for using with TensorFlow.
Python
2
star
34

mkdocs_include_exclude_files

Modify which files MkDocs includes or excludes.
Python
1
star
35

patrick-kidger

1
star
36

rl-test

Python
1
star