pub struct DataLoaderConfig {
pub batch_size: usize,
pub shuffle: bool,
pub num_workers: usize,
pub pin_memory: bool,
pub drop_last: bool,
pub timeout: Option<Duration>,
pub generator: Option<u64>,
pub prefetch_buffer_size: usize,
pub persistent_workers: bool,
pub pinning_config: Option<PinningConfig>,
}Expand description
Configuration for DataLoader creation with all options
This struct provides a comprehensive configuration interface that combines options from all DataLoader components.
Fields§
§batch_size: usizeBatch size for data loading
shuffle: boolWhether to shuffle the data
num_workers: usizeNumber of worker threads
pin_memory: boolWhether to pin memory for GPU transfers
drop_last: boolWhether to drop the last incomplete batch
timeout: Option<Duration>Timeout for batch collection
generator: Option<u64>Random seed for reproducible shuffling
prefetch_buffer_size: usizePrefetch buffer size (0 to disable prefetching)
persistent_workers: boolWhether to use persistent workers
pinning_config: Option<PinningConfig>Memory pinning configuration
Implementations§
Source§impl DataLoaderConfig
impl DataLoaderConfig
Sourcepub fn batch_size(self, batch_size: usize) -> Self
pub fn batch_size(self, batch_size: usize) -> Self
Set batch size
Sourcepub fn num_workers(self, num_workers: usize) -> Self
pub fn num_workers(self, num_workers: usize) -> Self
Set number of workers
Sourcepub fn pin_memory(self, pin_memory: bool) -> Self
pub fn pin_memory(self, pin_memory: bool) -> Self
Set pin memory
Sourcepub fn prefetch_buffer_size(self, size: usize) -> Self
pub fn prefetch_buffer_size(self, size: usize) -> Self
Set prefetch buffer size
Sourcepub fn persistent_workers(self, persistent: bool) -> Self
pub fn persistent_workers(self, persistent: bool) -> Self
Enable persistent workers
Sourcepub fn pinning_config(self, config: PinningConfig) -> Self
pub fn pinning_config(self, config: PinningConfig) -> Self
Set memory pinning configuration
Sourcepub fn for_training() -> Self
pub fn for_training() -> Self
Create a configuration optimized for training
Sourcepub fn for_inference() -> Self
pub fn for_inference() -> Self
Create a configuration optimized for inference
Sourcepub fn for_evaluation() -> Self
pub fn for_evaluation() -> Self
Create a configuration optimized for evaluation
Trait Implementations§
Source§impl Clone for DataLoaderConfig
impl Clone for DataLoaderConfig
Source§fn clone(&self) -> DataLoaderConfig
fn clone(&self) -> DataLoaderConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DataLoaderConfig
impl Debug for DataLoaderConfig
Auto Trait Implementations§
impl Freeze for DataLoaderConfig
impl RefUnwindSafe for DataLoaderConfig
impl Send for DataLoaderConfig
impl Sync for DataLoaderConfig
impl Unpin for DataLoaderConfig
impl UnsafeUnpin for DataLoaderConfig
impl UnwindSafe for DataLoaderConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.