tensor_span

Function tensor_span 

Source
pub fn tensor_span(
    tensor: &str,
    offsets: &Value,
    data_start: u64,
    file_len: u64,
) -> Result<TensorSpan>
Expand description

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 pair that isn’t two integers, a reversed pair (end < start, the underflow), and a span that runs past end-of-file. Callers get a named error instead of a wrapped length.