Skip to main content

batch_indices

Function batch_indices 

Source
pub fn batch_indices(
    dataset_size: usize,
    batch_size: usize,
    seed: u64,
) -> Vec<(usize, usize)>
Expand description

Creates deterministic batch index ranges for mini-batch training.

Generates (start, end) pairs that cover the entire dataset, shuffled deterministically using the provided seed via [SplitMix64].

§Arguments

  • dataset_size - Total number of samples
  • batch_size - Number of samples per batch (last batch may be smaller)
  • seed - RNG seed for deterministic shuffling

§Returns

A vector of (start, end) index pairs covering all samples.