Skip to content
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

Analog to flax.struct.dataclass #248

Open
homerjed opened this issue Mar 3, 2023 · 2 comments
Open

Analog to flax.struct.dataclass #248

homerjed opened this issue Mar 3, 2023 · 2 comments

Comments

@homerjed
Copy link

homerjed commented Mar 3, 2023

Hi chex team,

Is there any potential for something like flax.struct.dataclass in chex?

Basically a kind of dataclass that can mark static arguments.

Two other variations include jax_dataclasses and simple-pytree though a chex official one would be cool for all its benefits of being part of chex.

Thank you!

@patrick-kidger
Copy link

Check out equinox.Module. This does dataclass + pytree registration as with the other cases, and supports static fields (eqx.static_field).

It also correctly handles a number of other edge cases: subclassing, docstring handling, bound methods are also pytrees, etc.

@homerjed
Copy link
Author

Thanks @patrick-kidger, I will definitely use equinox next time around, its design is incredible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants