Repository navigation
Arbitrary spatial dimensions — the canvas is no longer locked to 2D.
What's new
spatial_shapeparameter:CanvasLayout,compile_schema, andcompile_programall acceptspatial_shape=(...)for 1D, 2D, 3D, or higher.- 1D time-series:
Field(spatial_shape=(128,))+compile_schema(..., spatial_shape=(200,)) - 3D volumetric:
Field(spatial_shape=(4, 4, 4))+compile_schema(..., spatial_shape=(8, 8, 8)) - N-D positional encoding:
SinusoidalPositionalEncodingNDsplits d_model evenly across all dimensions. - N-D packing: 1D linear, 2D strip (unchanged), 3D+ stacked greedy.
- N-D masks:
Rectgeneralized to hyperrectangles,rect_coverworks on any-dimensional boolean masks. - Schema format: Serializes
spatial_shapelist; reads oldH/Wformat transparently.
Backward compatible
The old H=/W= API continues to work unchanged. All 478 existing tests pass without modification.
# All of these still work exactly as before:
CanvasLayout(T=5, H=8, W=8, d_model=256)
Field(12, 12)
compile_schema(Robot(), T=8, H=16, W=16, d_model=256)