pub trait Dtype:
Sealed
+ ConstrainedTypeShape
+ GroundedShape
+ IntoBindingValue
+ Default
+ Copy
+ 'static {
const NAME: &'static str;
const BLOCK_BYTES: usize;
const BLOCK_ELEMS: usize;
}Expand description
Tensor element-type discipline.
A Dtype declares the canonical block layout of one tensor element
(continuous types) or one quantization block (block-32 / block-256
quantized types). The trait is sealed per ADR-014; impls are confined
to this module and reachable through TensorDtypeRegistry for
container-format-realization enumeration per ADR-057.
Per ADR-017’s closure rule, two Dtype impls with identical
BLOCK_BYTES content-address identically at the
framework level. The Rust-type distinction is the application-level
ergonomics surface (e.g., F16 vs BF16 are framework-equivalent
2-byte shapes but Rust-distinct dtypes carrying distinct
floating-point interpretations at the container-format layer).
Required Associated Constants§
Sourceconst BLOCK_BYTES: usize
const BLOCK_BYTES: usize
Bytes per block. For continuous element types this is the element
byte count; for quantized types this is the block-bytes count
(= the GGML block_q*_* sizeof).
Sourceconst BLOCK_ELEMS: usize
const BLOCK_ELEMS: usize
Elements per block. 1 for continuous types; 32 for legacy
quantization; 256 for K-series quantization.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.