Trait multi_skill::data_processing::Dataset[][src]

pub trait Dataset {
    type Item;
    fn len(&self) -> usize;
fn get(&self, index: usize) -> Self::Item; fn cached(self, cache_dir: impl Into<PathBuf>) -> CachedDataset<Self>
    where
        Self: Sized
, { ... }
fn iter(&self) -> Box<dyn Iterator<Item = Self::Item>> { ... } }

Generic Dataset trait, modeled after PyTorch's utils.data.Dataset. It represents a collection of objects indexed by integers from 0 to len().

Associated Types

type Item[src]

The type of objects procured by the Dataset.

Loading content...

Required methods

fn len(&self) -> usize[src]

The number of objects in the Dataset.

fn get(&self, index: usize) -> Self::Item[src]

Get the index'th element, where 0 <= index < len()

Loading content...

Provided methods

fn cached(self, cache_dir: impl Into<PathBuf>) -> CachedDataset<Self> where
    Self: Sized
[src]

Modifies the dataset to check a cache directory before reading. If the cache entry is present, it's used instead of the underlying get(). If the cache entry is absent, it will be created after calling get().

fn iter(&self) -> Box<dyn Iterator<Item = Self::Item>>[src]

Produces an Iterator that produces the entire Dataset in indexed order.

Loading content...

Implementations on Foreign Types

impl<T: Clone> Dataset for [T][src]

A slice can act as an in-memory Dataset.

type Item = T

impl<D: Dataset + ?Sized> Dataset for &D[src]

References to Datasets are also Datasets.

type Item = D::Item

impl<D: Dataset + ?Sized> Dataset for Box<D>[src]

type Item = D::Item

Loading content...

Implementors

impl<D: Dataset> Dataset for CachedDataset<D> where
    D::Item: Serialize + DeserializeOwned
[src]

type Item = D::Item

impl<T, F: Fn(usize) -> T> Dataset for ClosureDataset<T, F>[src]

type Item = T

Loading content...