pub fn tensor_span(
tensor: &str,
offsets: &Value,
data_start: u64,
file_len: u64,
) -> Result<TensorSpan>Expand description
2026-09-25: Validate one tensor’s data_offsets against the file that declared it.
offsets is the raw data_offsets JSON value, data_start is
8 + header_size (where the data section begins), and file_len is the
shard’s size on disk.
Rejects, in this order: a value that is not an array of two u64s, a
reversed pair (end < start, the underflow), an absolute start or end
that overflows u64, and a span that runs past end-of-file. Callers get a
named error instead of a wrapped length.