Skip to main content

Module tensor_dtype

Module tensor_dtype 

Source
Expand description

Typed tensor storage: DType enum and byte-first TypedStorage. Typed tensor infrastructure: DType enum and TypedStorage.

This module provides the byte-first storage layer for multi-typed tensors. The core idea: raw bytes are the primary representation, typed views are computed on demand. This enables zero-copy serialization (snap), SIMD-friendly aligned buffers, and memory-efficient storage for non-f64 types.

§Byte-First Philosophy

  • TypedStorage stores raw Vec<u8> + a DType tag
  • Typed access via as_f64(), as_i64(), etc. reinterprets bytes in-place
  • Serialization = memcpy the byte buffer (no conversion)
  • COW semantics via Rc<RefCell<Vec<u8>>> (same pattern as Buffer)

Structs§

TypedStorage
Byte-first tensor storage with COW (copy-on-write) semantics.

Enums§

DType
Element type for typed tensor storage.