Skip to main content

choice

Function choice 

Source
pub fn choice<B: Backend, T: Element>(
    key: &Key<B>,
    a: &Array<B, T>,
    shape: impl Into<Shape>,
    replace: bool,
) -> Array<B, T>
Expand description

Random elements of a along axis 0 (jax.random.choice with p=None and axis=0), with or without replacement. Use jnp::arange for the integer form choice(key, n, ...).

ยงPanics

Panics if a is a scalar or empty, or if replace is false and more elements are drawn than a has.