pub struct MNIST { /* private fields */ }Expand description
MNIST dataset loader
Loads the MNIST handwritten digits dataset.
Implementations§
Source§impl MNIST
impl MNIST
Sourcepub fn load<P: AsRef<Path>>(data_dir: P) -> Result<Self>
pub fn load<P: AsRef<Path>>(data_dir: P) -> Result<Self>
Load MNIST from directory containing the 4 files
Sourcepub fn train_data(&self) -> (&[Vec<f32>], &[u8])
pub fn train_data(&self) -> (&[Vec<f32>], &[u8])
Get training data
Sourcepub fn train_batch(&self, start: usize, batch_size: usize) -> (Tensor, Tensor)
pub fn train_batch(&self, start: usize, batch_size: usize) -> (Tensor, Tensor)
Get a batch of training data as tensors
Sourcepub fn train_size(&self) -> usize
pub fn train_size(&self) -> usize
Get number of training samples
Auto Trait Implementations§
impl Freeze for MNIST
impl RefUnwindSafe for MNIST
impl Send for MNIST
impl Sync for MNIST
impl Unpin for MNIST
impl UnwindSafe for MNIST
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