ai_dataloader/indexable/sampler.rs
1//! Defines the strategy to draw samples from the dataset.
2//!
3
4use crate::Len;
5
6mod batch_sampler;
7mod random_sampler;
8mod sequential_sampler;
9
10pub use batch_sampler::{BatchIterator, BatchSampler};
11pub use random_sampler::RandomSampler;
12pub use sequential_sampler::SequentialSampler;
13
14// TODO: maybe copy is too restrictive and should be replaced by Clone?
15/// Every Sampler is iterable and has a length.
16pub trait Sampler: Len + IntoIterator<Item = usize> + Copy {
17 /// Create a new sampler form the dataset length.
18 fn new(data_source_len: usize) -> Self;
19}