GithubHelp home page GithubHelp logo

isabella232 / jaxtyping Goto Github PK

View Code? Open in Web Editor NEW

This project forked from patrick-kidger/jaxtyping

0.0 0.0 0.0 35 KB

Type annotations and runtime checking for shape and dtype of JAX arrays, and PyTrees.

License: Other

Python 100.00%

jaxtyping's Introduction

jaxtyping

Type annotations and runtime checking for:

  1. shape and dtype of JAX arrays;
  2. PyTrees.

For example:

from jaxtyping import f32, PyTree

def matrix_multiply(x: f32["dim1 dim2"], y: f32["dim2 dim3"]) -> f32["dim1 dim3"]:
    ...

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

def accepts_pytree_of_arrays(x: PyTree[f32["batch c1 c2"]]):
    ...

Installation

pip install jaxtyping

Requires JAX 0.3.4+.

Also install your favourite runtime type-checking package. The two most popular are typeguard (which exhaustively checks every argument) and beartype (which checks random pieces of arguments).

Documentation

Full API reference

FAQ (static type checking, flake8, etc.)

Finally

See also: other tools in the JAX ecosystem

Neural networks: Equinox.

Numerical differential equation solvers: Diffrax.

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

Acknowledgements

Shape annotations + runtime type checking is inspired by TorchTyping.

The concise syntax is inspired by etils.array_types.

Disclaimer

This is not an official Google product.

jaxtyping's People

Contributors

patrick-kidger avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.