1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! Defines the strategy to draw samples from the dataset.
//!

use crate::Len;

mod batch_sampler;
mod random_sampler;
mod sequential_sampler;

pub use batch_sampler::{BatchIterator, BatchSampler};
pub use random_sampler::RandomSampler;
pub use sequential_sampler::SequentialSampler;

// TODO: maybe copy is too restrictive and should be replaced by Clone?
/// Every Sampler is iterable and has a length.
pub trait Sampler: Len + IntoIterator<Item = usize> + Copy {
    /// Create a new sampler form the dataset length.
    fn new(data_source_len: usize) -> Self;
}