Skip to main content

select_and_scatter_add

Function select_and_scatter_add 

Source
pub fn select_and_scatter_add<T: Element>(
    source: &[T],
    operand: &[T],
    shape: &[usize],
    dimensions: &[usize],
    window_strides: &[usize],
    padding: &[(i64, i64)],
    ge: bool,
) -> Vec<T>
Expand description

select_and_scatter_add: for each window of operand (of shape shape), selects an element (ge: the first maximum, otherwise the first minimum, as XLA’s select_and_scatter with the comparison as select) and adds the window’s element of source to it in the result (zeros elsewhere). Windows are visited in row-major order.

As JAX lowers it on CPU, padding holds the identity of the selection (the lowest value for ge, the highest otherwise) and can be selected, in which case the source element is dropped.