Expand description
CSF (Compressed Sparse Fiber) element lookup and storage-invariant validation.
Implements the per-level binary-search descent from
docs/spec/layouts/csf.md § Element Lookup and the invariant checks from
docs/spec/layouts/csf.md § Storage Invariants.
All arithmetic uses checked_* to avoid silent overflow — this code can run
on arbitrarily large tensors.
Functions§
- element_
offset - Looks up the storage offset (
valuesbuffer index) for a logical index in a CSF tensor, or returnsNoneif the element is structurally absent (implicit zero). - validate_
index_ buffers - Validates the storage invariants for all CSF index buffers.