pub struct MapDataset<D: Dataset> { /* private fields */ }Expand description
Wraps a dataset and applies a Transform lazily on each get().
Implementations§
Source§impl<D: Dataset> MapDataset<D>
impl<D: Dataset> MapDataset<D>
Sourcepub fn new(
inner: D,
transform: Box<dyn Transform>,
feat_shape: Vec<usize>,
tgt_shape: Vec<usize>,
) -> Self
pub fn new( inner: D, transform: Box<dyn Transform>, feat_shape: Vec<usize>, tgt_shape: Vec<usize>, ) -> Self
Create a MapDataset.
feat_shape and tgt_shape describe the shapes after the
transform is applied. If the transform doesn’t change shapes,
you can clone them from the inner dataset.
Sourcepub fn same_shape(inner: D, transform: Box<dyn Transform>) -> Self
pub fn same_shape(inner: D, transform: Box<dyn Transform>) -> Self
Convenience: create a MapDataset whose shapes are unchanged.
Trait Implementations§
Source§impl<D: Dataset> Dataset for MapDataset<D>
impl<D: Dataset> Dataset for MapDataset<D>
Source§fn feature_shape(&self) -> &[usize]
fn feature_shape(&self) -> &[usize]
The shape of a single feature sample (without batch dim).
Source§fn target_shape(&self) -> &[usize]
fn target_shape(&self) -> &[usize]
The shape of a single target sample (without batch dim).
Auto Trait Implementations§
impl<D> Freeze for MapDataset<D>where
D: Freeze,
impl<D> !RefUnwindSafe for MapDataset<D>
impl<D> Send for MapDataset<D>
impl<D> Sync for MapDataset<D>
impl<D> Unpin for MapDataset<D>where
D: Unpin,
impl<D> UnsafeUnpin for MapDataset<D>where
D: UnsafeUnpin,
impl<D> !UnwindSafe for MapDataset<D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more