Struct PartialDataset
pub struct PartialDataset<D, I> { /* private fields */ }Expand description
Only use a fraction of an existing dataset lazily.
Implementations§
§impl<D, I> PartialDataset<D, I>
impl<D, I> PartialDataset<D, I>
pub fn new(
dataset: D,
start_index: usize,
end_index: usize,
) -> PartialDataset<D, I>
pub fn new( dataset: D, start_index: usize, end_index: usize, ) -> PartialDataset<D, I>
Constructs a new PartialDataset.
§impl<D, I> PartialDataset<D, I>where
D: Dataset<I>,
impl<D, I> PartialDataset<D, I>where
D: Dataset<I>,
pub fn split(dataset: D, num: usize) -> Vec<PartialDataset<Arc<D>, I>>
pub fn split(dataset: D, num: usize) -> Vec<PartialDataset<Arc<D>, I>>
Splits a dataset into multiple partial datasets.
pub fn split_chunks(
dataset: D,
num: usize,
batch_size: usize,
) -> Vec<PartialDataset<Arc<D>, I>>
pub fn split_chunks( dataset: D, num: usize, batch_size: usize, ) -> Vec<PartialDataset<Arc<D>, I>>
Splits a dataset by distributing complete chunks/batches across multiple partial datasets.
Trait Implementations§
§impl<D, I> Clone for PartialDataset<D, I>
impl<D, I> Clone for PartialDataset<D, I>
§fn clone(&self) -> PartialDataset<D, I>
fn clone(&self) -> PartialDataset<D, I>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl<D, I> Dataset<I> for PartialDataset<D, I>
impl<D, I> Dataset<I> for PartialDataset<D, I>
Auto Trait Implementations§
impl<D, I> Freeze for PartialDataset<D, I>where
D: Freeze,
impl<D, I> RefUnwindSafe for PartialDataset<D, I>where
D: RefUnwindSafe,
I: RefUnwindSafe,
impl<D, I> Send for PartialDataset<D, I>
impl<D, I> Sync for PartialDataset<D, I>
impl<D, I> Unpin for PartialDataset<D, I>
impl<D, I> UnwindSafe for PartialDataset<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
}