pub fn data2vec_mask(
n_tokens: usize,
mask_ratio: f32,
rng: &mut LcgRng,
) -> SslResult<Vec<bool>>Expand description
Generate a boolean mask of length n_tokens with exactly
floor(n_tokens × mask_ratio) positions set to true (= masked).
The selection is performed via a Fisher-Yates partial shuffle over an index
array, mirroring the approach in crate::masked::mae::random_patch_mask,
but produces a Vec<bool> directly keyed to token indices.
§Errors
SslError::EmptyInputwhenn_tokens == 0.SslError::InvalidMaskRatiowhenmask_ratiois outside[0, 1)or non-finite.