pub trait TensorGenome: GenomeKind {
type Tensor<B: Backend>: Clone + Debug + Send + Sync;
}Expand description
Genome kinds with a rectangular, device-resident tensor representation.
This is the subset of GenomeKinds that a
Population can store on-device. The
associated Tensor type names which tensor flavour
backs the kind, tying the storage type to the marker at compile time: Real
maps to Tensor<B, 2>; Binary, Integer, and Permutation map to
Tensor<B, 2, Int>.
Because the storage type is chosen by the trait impl, Population<B, K> needs
only one field and no run-time tag — the wrong-tensor-for-this-kind state is
simply unrepresentable. Variable-length kinds such as Tree have no
rectangular form and deliberately do not implement this trait, so
Population<B, Tree> is not a valid type.
Required Associated Types§
Sourcetype Tensor<B: Backend>: Clone + Debug + Send + Sync
type Tensor<B: Backend>: Clone + Debug + Send + Sync
Device tensor type storing a whole population of this kind, shape
(pop_size, genome_dim).
The Send + Sync bound keeps Population<B, K> thread-safe under the
crate-wide Strategy: Send + Sync contract:
without it, generic code over K: TensorGenome could not prove the
stored tensor — and therefore the population — is shareable across
threads, even though every concrete Burn tensor is.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".