Skip to main content

shuffle

Function shuffle 

Source
pub fn shuffle<B: Backend, T: Element>(
    key: &Key<B>,
    x: &Array<B, T>,
) -> Array<B, T>
Expand description

x with its elements along axis 0 randomly permuted (jax.random.permutation(key, x), with axis=0 and independent=False): the rows are taken in the order of permutation of their number.

§Panics

Panics if x is a scalar.

§Examples

use ruxla_core::{Array, Native, random};

let x = Array::<Native, f32>::from_vec(vec![0.0, 1.0, 2.0, 3.0, 4.0, 5.0], [3, 2]);
let y = random::shuffle(&random::key(0), &x);
assert_eq!(y.shape().dims(), [3, 2]);