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
52
53
//! # Tensor and Parameter Descriptors
//!
//! Serializable, reference-free descriptions of `burn` tensors, parameters,
//! and comparison tolerances. A descriptor is a plain value: it carries a
//! tensor's metadata without its data, its backend, or the `Tensor<B, R, K>`
//! generics, so code that is not generic over a tensor type can still name,
//! store, and compare tensors.
//!
//! ## How they relate
//!
//! - [`TensorKindDesc`] names a tensor kind (`Bool`, `Float`, `Int`) as a
//! value; [`ParamKindBinding`] maps `burn`'s kind marker types to it.
//! - [`TensorRankType`] is the slot type of a tensor: kind, dtype, and rank,
//! without a shape.
//! - [`TensorDesc`] is kind, dtype, and the full
//! [`Shape`](burn::prelude::Shape), which it derefs to;
//! [`to_rank_type`](TensorDesc::to_rank_type) drops the shape again.
//! - [`ParamDesc<T>`](ParamDesc) pairs a descriptor with the
//! [`ParamId`](burn::module::ParamId) of the parameter it describes, and
//! derefs to the descriptor. [`TensorParamDesc`] is `ParamDesc<TensorDesc>`,
//! built `From` a `&Param<Tensor<B, R, K>>`.
//! - [`ToleranceDesc`] describes an approximate comparison: a
//! [`TolerancePolicy`] (which [`Tolerance`](burn::tensor::Tolerance) rule)
//! plus the float type the rule resolves at.
//! - [`dtype_from_str`] parses a `DType` from its `Display` form, and [`shims`]
//! holds serde adapters for `burn` types that do not derive serde.
//!
//! ## Who uses them
//!
//! - Reflection:
//! [`XmlModuleTree`](crate::burner::module::reflection::XmlModuleTree) stores
//! a `TensorParamDesc` on each parameter's XML node, and its queries return
//! them. Their `ParamId`s are what an
//! [`OptimizerGroup`](crate::burner::optim::OptimizerGroup) is built from.
//! - Audit: an approximate-equality checkpoint takes a `TolerancePolicy`, and
//! the recorded event stores it with its float type as a `ToleranceDesc`, so
//! a stored baseline is verified under the tolerance it was recorded with.
//! - [`DynTensor`](crate::burner::tensor::dynamic::DynTensor) reports its
//! `TensorKindDesc`, and converts to a `TensorDesc` or a `TensorRankType`.
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;