pub struct Sample {
pub features: Vec<f64>,
pub feature_shape: Vec<usize>,
pub target: Vec<f64>,
pub target_shape: Vec<usize>,
}Expand description
A single sample: a pair of (input features, label/target).
Both are stored as Vec<f64> with their associated shapes so they can be
batched into tensors later.
Fields§
§features: Vec<f64>Input feature vector (flattened).
feature_shape: Vec<usize>Shape of the feature tensor (e.g. [784] for MNIST, [3,32,32] for CIFAR).
target: Vec<f64>Target / label value(s) (flattened). For classification this is typically
a single-element vec holding the class index as f64.
target_shape: Vec<usize>Shape of the target tensor (e.g. [1] for a class index, [10] for one-hot).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sample
impl RefUnwindSafe for Sample
impl Send for Sample
impl Sync for Sample
impl Unpin for Sample
impl UnsafeUnpin for Sample
impl UnwindSafe for Sample
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