Skip to main content

gaussian_mutation

Function gaussian_mutation 

Source
pub fn gaussian_mutation<B: Backend>(
    population: Tensor<B, 2>,
    sigma: NonNegativeRate,
    rng: &mut dyn Rng,
    device: &<B as BackendTypes>::Device,
) -> Tensor<B, 2>
Expand description

Isotropic Gaussian mutation with a scalar step-size σ.

Each gene in the population is independently perturbed by σ · N(0, 1) noise. The same σ is applied to every individual and every gene dimension. When σ = 0 the function is an identity and returns a tensor numerically equal to the input.

The n·d standard-normal draws are taken from the caller-supplied host rng via crate::sampling::standard_normal and loaded onto the device using Tensor::from_data; no backend-global RNG state is touched.

The input tensor must have shape (N, D) where N is the population size and D is the genome length; the returned tensor has the same shape.

For per-individual step-sizes see gaussian_mutation_per_row.