Skip to main content

Module tensor_checksum

Module tensor_checksum 

Source
Expand description

Tensor Checksum Engine

Computes and verifies checksums for tensor data to detect corruption during storage or transmission. Supports multiple pure-Rust checksum algorithms with a stateful engine that tracks per-tensor records and verification stats.

§Algorithms

AlgorithmWidthSpeedUse-case
Fnv1a6464-bitFastGeneral-purpose, non-cryptographic hash
Adler3232-bitFastData integrity, used in zlib
Fletcher1616-bitFastLightweight embedded / small payloads
XorFold64-bitFastestUltra-fast, low-collision large tensors

§Examples

use ipfrs_tensorlogic::tensor_checksum::{
    ChecksumAlgorithm, TensorChecksumEngine,
};

let mut engine = TensorChecksumEngine::new();
let data = b"hello tensor world";
let record = engine.compute(1, "layer0".to_string(), data, ChecksumAlgorithm::Fnv1a64, 0);
assert!(record.is_valid(data));

let ok = engine.verify(1, data).expect("example: should succeed in docs");
assert!(ok);

Structs§

ChecksumEngineStats
Aggregate statistics for a TensorChecksumEngine instance.
ChecksumRecord
Associates a TensorChecksum with a specific tensor and layer name.
TensorChecksum
A checksum value together with the metadata needed to re-verify data later.
TensorChecksumEngine
Stateful engine that manages per-tensor checksum records.

Enums§

ChecksumAlgorithm
Checksum algorithm selection.

Functions§

adler32
Adler-32 checksum (pure Rust).
fletcher16
Fletcher-16 checksum (pure Rust).
fnv1a64
Compute the FNV-1a 64-bit hash over arbitrary bytes.
xor_fold
XOR-fold checksum.