Defining New JAX Types with hijax for Custom Data Structures
Defining new Jax types with hijax
I explore how hijax types in JAX let you define custom data structures with strict invariants, unlike standard pytrees. By subclassing HiType, you can control how values appear in traced code, manage unique tangent types for derivatives, and handle batching or sharding explicitly. This approach ensures your aggregate data maintains its identity and integrity throughout transformations.
"Some data is best modeled as a new type, with its own identity, rather than as a spray of array leaves."