pub struct DataLoader<D, C = DefaultCollate>{ /* private fields */ }Expand description
Data loader.
Implementations§
Source§impl<D, C> DataLoader<D, C>
impl<D, C> DataLoader<D, C>
Sourcepub fn new(dataset: D, collate_fn: C, batch_size: usize) -> CoreResult<Self>
pub fn new(dataset: D, collate_fn: C, batch_size: usize) -> CoreResult<Self>
New.
Sourcepub fn builder_with_collate(
dataset: D,
collate_fn: C,
) -> DataLoaderBuilder<D, C>
pub fn builder_with_collate( dataset: D, collate_fn: C, ) -> DataLoaderBuilder<D, C>
Starts a builder with a default batch size of one.
Sourcepub fn with_num_workers(self, num_workers: usize) -> Self
pub fn with_num_workers(self, num_workers: usize) -> Self
With num workers.
Sourcepub fn with_shuffle(self, shuffle: bool) -> Self
pub fn with_shuffle(self, shuffle: bool) -> Self
With shuffle.
Sourcepub fn with_drop_last(self, drop_last: bool) -> Self
pub fn with_drop_last(self, drop_last: bool) -> Self
Drops the final incomplete batch when enabled.
Sourcepub fn with_prefetch(self, prefetch: NonZeroUsize) -> Self
pub fn with_prefetch(self, prefetch: NonZeroUsize) -> Self
Sets bounded worker prefetch capacity.
Sourcepub fn with_epoch(self, epoch: u64) -> Self
pub fn with_epoch(self, epoch: u64) -> Self
Sets the deterministic epoch number.
Sourcepub fn with_timeout(self, timeout: Option<Duration>) -> Self
pub fn with_timeout(self, timeout: Option<Duration>) -> Self
Sets an explicit worker receive timeout.
Source§impl<D> DataLoader<D, DefaultCollate>
impl<D> DataLoader<D, DefaultCollate>
Sourcepub fn from_dataset(dataset: D, batch_size: usize) -> CoreResult<Self>
pub fn from_dataset(dataset: D, batch_size: usize) -> CoreResult<Self>
Creates a loader using DefaultCollate for scalar, tuple, and tensor
batches.
Sourcepub fn default_builder(dataset: D) -> DataLoaderBuilder<D, DefaultCollate>
pub fn default_builder(dataset: D) -> DataLoaderBuilder<D, DefaultCollate>
Starts a builder using DefaultCollate.
Sourcepub fn builder(dataset: D) -> DataLoaderBuilder<D, DefaultCollate>
pub fn builder(dataset: D) -> DataLoaderBuilder<D, DefaultCollate>
Starts a builder using DefaultCollate.
Trait Implementations§
Source§impl<D, C> IntoIterator for &DataLoader<D, C>
impl<D, C> IntoIterator for &DataLoader<D, C>
Auto Trait Implementations§
impl<D, C> Freeze for DataLoader<D, C>
impl<D, C> RefUnwindSafe for DataLoader<D, C>
impl<D, C> Send for DataLoader<D, C>
impl<D, C> Sync for DataLoader<D, C>
impl<D, C> Unpin for DataLoader<D, C>
impl<D, C> UnsafeUnpin for DataLoader<D, C>
impl<D, C> UnwindSafe for DataLoader<D, C>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> DTypeEq<T> for T
impl<T> DTypeEq<T> for T
Source§const DTYPES_EQUAL: bool = true
const DTYPES_EQUAL: bool = true
A type is always dtype-equal to itself.
Source§const ASSERT_DTYPES_MATCH: ()
const ASSERT_DTYPES_MATCH: ()
Always passes, since T: DTypeEq<T> only reaches this impl when
the two types genuinely match.
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<N> SameCount<N> for N
Source§impl<S> ShapeEq<S> for S
impl<S> ShapeEq<S> for S
Source§const SHAPES_EQUAL: bool = true
const SHAPES_EQUAL: bool = true
A type is always shape-equal to itself.
Source§const ASSERT_SHAPES_MATCH: ()
const ASSERT_SHAPES_MATCH: ()
Always passes, since S: ShapeEq<S> only reaches this impl when
the two types genuinely match.