DataLoader

Trait DataLoader 

Source
pub trait DataLoader {
    // Required methods
    fn get_size(
        &self,
        slice: Option<DataSlice>,
    ) -> Result<Vec<usize>, AutoDiffError>;
    fn get_item(
        &self,
        index: usize,
        slice: Option<DataSlice>,
    ) -> Result<(Var, Var), AutoDiffError>;
    fn get_batch(
        &self,
        start: usize,
        end: usize,
        slice: Option<DataSlice>,
    ) -> Result<(Var, Var), AutoDiffError>;

    // Provided method
    fn get_indexed_batch(
        &self,
        index: &[usize],
        slice: Option<DataSlice>,
    ) -> Result<(Var, Var), AutoDiffError> { ... }
}

Required Methods§

Source

fn get_size( &self, slice: Option<DataSlice>, ) -> Result<Vec<usize>, AutoDiffError>

The shape of the data if applicable.

Source

fn get_item( &self, index: usize, slice: Option<DataSlice>, ) -> Result<(Var, Var), AutoDiffError>

Return one sample.

Source

fn get_batch( &self, start: usize, end: usize, slice: Option<DataSlice>, ) -> Result<(Var, Var), AutoDiffError>

Return a batch following original order.

Provided Methods§

Source

fn get_indexed_batch( &self, index: &[usize], slice: Option<DataSlice>, ) -> Result<(Var, Var), AutoDiffError>

Return a batch given the index.

Implementors§