pub struct InMemDataset<I> { /* private fields */ }Expand description
Dataset where all items are stored in ram.
Implementations§
Source§impl<I> InMemDataset<I>
impl<I> InMemDataset<I>
Source§impl<I> InMemDataset<I>where
I: Clone + DeserializeOwned,
impl<I> InMemDataset<I>where
I: Clone + DeserializeOwned,
Sourcepub fn from_dataset(dataset: &impl Dataset<I>) -> Self
pub fn from_dataset(dataset: &impl Dataset<I>) -> Self
Create from a dataset. All items are loaded in memory.
Sourcepub fn from_json_rows<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn from_json_rows<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Create from a json rows file (one json per line).
Trait Implementations§
Source§impl<I> Dataset<I> for InMemDataset<I>
impl<I> Dataset<I> for InMemDataset<I>
Auto Trait Implementations§
impl<I> Freeze for InMemDataset<I>
impl<I> RefUnwindSafe for InMemDataset<I>where
I: RefUnwindSafe,
impl<I> Send for InMemDataset<I>where
I: Send,
impl<I> Sync for InMemDataset<I>where
I: Sync,
impl<I> Unpin for InMemDataset<I>where
I: Unpin,
impl<I> UnwindSafe for InMemDataset<I>where
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<I, T> Windows<I> for Twhere
T: Dataset<I>,
impl<I, T> Windows<I> for Twhere
T: Dataset<I>,
Source§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
}