-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
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
Batched pytree dataclasses #242
Comments
Not right now, although this seems like a reasonable request! Thinking this over, I don't think we want Rather, I'm thinking we could arrange for the I'd be happy to consider a PR on this! (Independently of the above, I'd really recommend using |
Thanks @patrick-kidger for the fast response :) jaxtyping/jaxtyping/_array_types.py Line 180 in 09235dd
And I don't get why to use vmap, do you maybe man (Note that I am not very familiar with the codebase, so maybe you meant the right thing and I am just missing the context 😅 ) |
Yup, exactly that! And indeed I meant FWIW I think this is probably a fairly tricky thing to add, which is why I'm not jumping on quickly doing it myself 😄 (Fun side note. jaxtyping started out as supporting just |
In a similar vein, if you could have syntax that is a bit like python's generics so you could include the dimensions as parameters in a (probably equinox) dataclass: @jaxtyped(typechecker=typechecker)
class MyClass['*dims a b'](eqx.Module):
field_a: Float[Array, '*dims a 2']]
field_b: Float[Array, '*dims b 5']] you might be able to get the same effect? |
Thanks @patrick-kidger, @benjamin-macadam this also looks interesting. However, with this approach, I could not add batch dimensions to dataclasses that are not part of my code (e.g. part of a lib that I am using). |
Hi, I really like this library for jax type annotations.
But for me one important use-case is missing, which is annotating added dimensions to custom pytree dataclasses.
Here is an example use case (adding a batch dimension to a dataclass)
Sadly the code above does not work. Is it possible to specify this in another way?
The text was updated successfully, but these errors were encountered: