pub trait Dataset: Send + Sync {
// Required methods
fn len(&self) -> usize;
fn get(&self, index: usize) -> Sample;
fn feature_shape(&self) -> &[usize];
fn target_shape(&self) -> &[usize];
// Provided methods
fn is_empty(&self) -> bool { ... }
fn name(&self) -> &str { ... }
}Expand description
A dataset is an indexed collection of samples.
Implementations must be Send + Sync so DataLoader can read from multiple
threads when parallel prefetching is enabled.
Required Methods§
Sourcefn feature_shape(&self) -> &[usize]
fn feature_shape(&self) -> &[usize]
The shape of a single feature sample (without batch dim).
Sourcefn target_shape(&self) -> &[usize]
fn target_shape(&self) -> &[usize]
The shape of a single target sample (without batch dim).