ptwm_core::compact
ptwm_core::compact
Compact single-tensor frame (magic \x89PTWS).
ptwm_core::compact
crates/ptwm-core/src/compact.rs:1mod compactCompact single-tensor frame (magic `\x89PTWS`).
ptwm_core::compact::CompactTensor
crates/ptwm-core/src/compact.rs:141pub struct CompactTensorA tensor decoded from a compact frame.
ptwm_core::compact::compress_compact
crates/ptwm-core/src/compact.rs:183pub fn compress_compact(input: &InputTensor<'_>, opts: &CompressorOptions) -> Result<Option<Vec<u8>>, PtwmCoreError>Encode one tensor as a compact frame.
ptwm_core::compact::decode_compact
crates/ptwm-core/src/compact.rs:407pub fn decode_compact(buf: &[u8]) -> Result<CompactTensor, PtwmCoreError>Decode a compact frame. Verifies the payload hash and plane CRCs when the frame carries them.
ptwm_core::compact::FLAG_DELTA_REF
crates/ptwm-core/src/compact.rs:117pub const FLAG_DELTA_REFThe frame carries the BLAKE3 hash of a delta reference.
ptwm_core::compact::FLAG_DTYPE_NAME
crates/ptwm-core/src/compact.rs:115pub const FLAG_DTYPE_NAMEThe frame carries a dtype name that differs from the canonical name of `dtype_code`.
ptwm_core::compact::FLAG_PAYLOAD_HASH
crates/ptwm-core/src/compact.rs:107pub const FLAG_PAYLOAD_HASHThe frame carries an xxh64 of the raw bytes.
ptwm_core::compact::FLAG_PLANE_CRC
crates/ptwm-core/src/compact.rs:110pub const FLAG_PLANE_CRCEvery coded plane carries a CRC32 of its raw bytes. Not combined with [`FLAG_PAYLOAD_HASH`], which already covers every plane.
ptwm_core::compact::FLAG_SHAPE
crates/ptwm-core/src/compact.rs:112pub const FLAG_SHAPEThe frame carries the tensor shape.
ptwm_core::compact::FLAG_SIZE
crates/ptwm-core/src/compact.rs:121pub const FLAG_SIZEThe frame stores `orig_size` because the shape does not give it.
ptwm_core::compact::FLAG_STORED
crates/ptwm-core/src/compact.rs:119pub const FLAG_STOREDThe body is the raw bytes, not a coded tensor.
ptwm_core::compact::is_compact
crates/ptwm-core/src/compact.rs:160pub fn is_compact(buf: &[u8]) -> boolReturn `true` when `buf` starts with the compact-frame magic.
ptwm_core::compact::MAGIC_COMPACT
crates/ptwm-core/src/compact.rs:104pub const MAGIC_COMPACTCompact-frame magic. Shares the `\x89PTW` prefix with the full container.
ptwm_core::compact::size_from_shape
crates/ptwm-core/src/compact.rs:167pub fn size_from_shape(shape: &[u64], dtype_code: u16) -> Option<u64>Raw byte count implied by a shape and a public dtype code: `product(shape) × element_size`. `None` for an unknown dtype code or on overflow.