Skip to main content

Module weight_only

Module weight_only 

Source
Expand description

WeightOnly — a Strategy wrapper that ties a flat-genome strategy to a concrete Burn Module for weight-only neuroevolution.

WeightOnly<B, S, M> composes an inner S: Strategy<B, Genome = Tensor<B, 2>> with a fixed-topology module M. It owns a ModuleReshaper (the single source of truth for the genome width, num_params) but performs no reshaping in ask/tell — the genome stays a flat (pop_size, num_params) tensor and every Strategy method delegates verbatim to the inner strategy. Reshaping to a module happens only at the fitness boundary, in ModuleEvalFn (supervised fitness) or rlevo_hybrid’s RolloutFitness (RL fitness).

This follows the MemeticWrapper pattern (ADR 0016): the inner strategy owns all population state; the wrapper adds one orthogonal concern (here, the module binding).

§Gradient isolation

B: Backend, not AutodiffBackend. A caller holding an autodiff module calls .valid() before constructing the wrapper, so gradient tracking cannot leak into evolution — enforced at the type level.

Structs§

WeightOnly
Composes a flat-genome Strategy with a fixed-topology Burn Module.