Struct burn::data::dataset::transform::ShuffledDataset
pub struct ShuffledDataset<D, I> { /* private fields */ }
Expand description
Shuffled a dataset, consider using sampler dataset is you want a probability distribution that is computed lazily.
Implementations§
§impl<D, I> ShuffledDataset<D, I>where
D: Dataset<I>,
impl<D, I> ShuffledDataset<D, I>where
D: Dataset<I>,
pub fn new(dataset: D, rng: &mut StdRng) -> ShuffledDataset<D, I>
pub fn new(dataset: D, rng: &mut StdRng) -> ShuffledDataset<D, I>
Creates a new shuffled dataset.
pub fn with_seed(dataset: D, seed: u64) -> ShuffledDataset<D, I>
pub fn with_seed(dataset: D, seed: u64) -> ShuffledDataset<D, I>
Creates a new shuffled dataset with a fixed seed.
Trait Implementations§
§impl<D, I> Dataset<I> for ShuffledDataset<D, I>
impl<D, I> Dataset<I> for ShuffledDataset<D, I>
Auto Trait Implementations§
impl<D, I> Freeze for ShuffledDataset<D, I>where
D: Freeze,
impl<D, I> RefUnwindSafe for ShuffledDataset<D, I>where
D: RefUnwindSafe,
I: RefUnwindSafe,
impl<D, I> Send for ShuffledDataset<D, I>
impl<D, I> Sync for ShuffledDataset<D, I>
impl<D, I> Unpin for ShuffledDataset<D, I>
impl<D, I> UnwindSafe for ShuffledDataset<D, I>where
D: UnwindSafe,
I: UnwindSafe,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<I, T> Windows<I> for Twhere
T: Dataset<I>,
impl<I, T> Windows<I> for Twhere
T: Dataset<I>,
§fn windows(&self, size: usize) -> WindowsIterator<'_, I> ⓘ
fn windows(&self, size: usize) -> WindowsIterator<'_, I> ⓘ
Is empty if the Dataset
is shorter than size
.
§Panics
Panics if size
is 0.
§Examples
use crate::burn_dataset::{
transform::{Windows, WindowsDataset},
Dataset, InMemDataset,
};
let items = [1, 2, 3, 4].to_vec();
let dataset = InMemDataset::new(items.clone());
for window in dataset.windows(2) {
// do sth with window
}