1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Foreign tensor formats, projected into the zTensor object model — and the
//! layout profiles that assemble an object once it is read.
//!
//! Every format here builds a [`Catalog`](ztensor::provide::Catalog) of names,
//! shapes, types and byte locations, then hands back an ordinary
//! [`Source`](ztensor::Source). There is no per-format type in the public API,
//! because after projection there is nothing per-format left to say:
//!
//! ```no_run
//! let src = ztensor_compat::open("model.safetensors")?;
//! let t = src.tensor("layer.weight")?;
//! let bytes = t.data()?.map()?; // zero-copy where the file allows it
//! # Ok::<(), ztensor::Error>(())
//! ```
//!
//! Projections are read-only and honest. A part's payload says which of the
//! three shapes it has: a raw addressable range, something stored under an
//! encoding, or bytes only the format's own reader can produce. It also
//! [`Caps`](ztensor::Caps) is a direct reading of that. Nothing is silently
//! reinterpreted or dequantized, and nothing degrades quietly to a copy.
//!
//! A projected file reports its *actual* offsets; the `.zt` guarantees (the
//! 4096 floor, page exclusivity, digests) hold only for `.zt` files. To
//! upgrade a foreign checkpoint, convert it: `Writer::ingest` copies any
//! source into a canonical `.zt` file.
pub use ;