Skip to main content

binary_uniform_crossover

Function binary_uniform_crossover 

Source
pub fn binary_uniform_crossover<B: Backend>(
    parent_a: Tensor<B, 2, Int>,
    parent_b: Tensor<B, 2, Int>,
    p: f32,
    device: &B::Device,
) -> Tensor<B, 2, Int>
Expand description

Binary uniform crossover on Tensor<B, 2, Int> populations.

For each gene, keep parent A with probability p, else parent B. parent_a and parent_b must hold values in {0, 1}.

§Panics

Panics if the parents do not have matching shapes.