9 Commits
Author SHA1 Message Date
Patrick Kidger 33cf4fcdac Simplified internals by removing jaxtyping_raise; jaxtyping_malformed. 2023-12-05 19:06:00 -08:00
Patrick Kidger 12d540794f Pretty error messages: fixes #6.
Phew, this ended up being a pretty complicated change!
The basic summary is that we now support the syntax
```
@jaxtyped(typechecker=typechecker)
def f(...): ...
```
and when using this, we now get pretty error messages about what went
wrong.

(
The old syntax, i.e.
```
@jaxtyped
@typechecker
def f(...): ...
```
is still supported, but doesn't give much information.
)

The internals of this do quite a lot of magic! In particular we
dynamically create quite a lot of functions and test the provided
arguments against their signatures. The overhead should still be
minimal under `jax.jit`, though.
(TODO: what's the overhead like in non-jit situations, e.g. PyTorch?
I've tried to minimise the overhead throughout just to be sure, but
perhaps PyTorch users should stick to the old syntax?)
2023-11-27 09:50:02 -08:00
Patrick Kidger d12291de7e Added support for treepath-dependent sizes. 2023-11-27 09:50:02 -08:00
Patrick Kidger 9e1ba8a77d Added support for declaring PyTree structures. 2023-11-27 09:50:02 -08:00
Patrick Kidger 6a64ef114e Now provides PyTreeDef, and can detect PyTrees via issubclass(x, PyTree) 2023-06-01 10:56:00 -07:00
Peter Roelants d3651ca70e NamedTuple example (#36) 2022-10-03 07:40:51 -07:00
Patrick Kidger 903000f3d5 Rewrote syntax 2022-08-30 12:47:45 -07:00
Patrick Kidger 9f75958b2d Make test/helpers.py a relative import 2022-07-12 10:03:19 +01:00
Patrick Kidger 0800e5fa38 renamed tests->test so release workflow works 2022-07-11 13:06:54 +01:00