Skip to main content

MemoryMappedFileDataset

Struct MemoryMappedFileDataset 

Source
pub struct MemoryMappedFileDataset<T> { /* private fields */ }
Expand description

Enhanced memory-mapped dataset that loads data directly from files This provides true zero-copy access to very large datasets that exceed available RAM

Implementations§

Source§

impl<T> MemoryMappedFileDataset<T>
where T: Clone + Default + Zero + Send + Sync + 'static,

Source

pub fn from_file<P: AsRef<Path>>( file_path: P, num_samples: usize, feature_shape: Vec<usize>, label_shape: Vec<usize>, ) -> Result<Self>

Create a memory-mapped dataset directly from a file The file should contain binary data in the format: [sample0_features, sample0_labels, sample1_features, sample1_labels, …]

Source

pub fn auto_detect<P: AsRef<Path>>( file_path: P, feature_shape: Vec<usize>, label_shape: Vec<usize>, ) -> Result<Self>

Create a memory-mapped dataset from an existing file with automatic shape detection Assumes all samples have the same shape

Source

pub fn file_stats(&self) -> MemoryMappedFileStats

Get file statistics for monitoring

Source

pub fn get_batch_view( &self, start_index: usize, batch_size: usize, ) -> Result<&[u8]>

Create a view that spans multiple samples for batch processing

Trait Implementations§

Source§

impl<T> Dataset<T> for MemoryMappedFileDataset<T>
where T: Clone + Default + Zero + Send + Sync + Pod + 'static,

Available on crate feature mmap only.
Source§

fn len(&self) -> usize

Source§

fn get(&self, index: usize) -> Result<(Tensor<T>, Tensor<T>)>

Source§

fn is_empty(&self) -> bool

Source§

fn batch(self, batch_size: usize) -> BatchedDataset<T, Self>
where Self: Sized,

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T, D> AdvancedStatisticsExt<T> for D
where T: Clone + Default + Float + Send + Sync + Pod + Zeroable + 'static, D: Dataset<T>,

Source§

fn compute_multivariate_statistics( &self, ) -> Result<MultivariateStatistics<T>, TensorError>

Compute advanced multivariate statistics
Source§

fn compute_pca(&self, n_components: usize) -> Result<PCAResult<T>, TensorError>

Perform principal component analysis
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, D> CacheExt<T> for D
where D: Dataset<T>,

Source§

fn cached(self, capacity: usize) -> CachedDataset<T, Self>
where T: Clone + Send + Sync + 'static,

Wrap this dataset with caching
Source§

fn cached_with_warming( self, capacity: usize, strategy: WarmingStrategy, ) -> Result<CachedDataset<T, Self>>
where T: Clone + Send + Sync + 'static,

Wrap this dataset with caching and pre-warm the cache
Source§

impl<T, D> DataQualityExt<T> for D
where D: Dataset<T>,

Source§

fn analyze_quality(&self, name: impl Into<String>) -> Result<DataQualityMetrics>
where T: Clone + Default + Zero + Float + Send + Sync + 'static,

Analyze data quality
Source§

fn quality_report(&self, name: impl Into<String>) -> Result<String>
where T: Clone + Default + Zero + Float + Send + Sync + 'static,

Generate a quality report
Source§

impl<T, D> DatasetExt<T> for D
where D: Dataset<T>,

Source§

fn transform<Tr: Transform<T>>( self, transform: Tr, ) -> TransformedDataset<T, Self, Tr>

Apply a transform to this dataset
Source§

impl<T, D> DatasetShardingExt<T> for D
where D: Dataset<T>,

Source§

fn shard(self, config: ShardConfig) -> Result<ShardedDataset<T, Self>>

Shard this dataset for distributed training
Source§

fn shard_round_robin( self, world_size: usize, rank: usize, ) -> Result<ShardedDataset<T, Self>>

Create a round-robin sharded dataset
Source§

fn shard_contiguous( self, world_size: usize, rank: usize, ) -> Result<ShardedDataset<T, Self>>

Create a contiguous sharded dataset
Source§

fn shard_shuffled( self, world_size: usize, rank: usize, seed: u64, ) -> Result<ShardedDataset<T, Self>>

Create a shuffled sharded dataset with a seed
Source§

impl<T, D> DatasetStatisticsExt<T> for D
where T: Clone + Default + Zero + Float + Debug + Send + Sync + 'static, D: Dataset<T>,

Source§

fn compute_statistics(&self) -> Result<DatasetStats<T>, TensorError>

Compute statistics with default configuration
Source§

fn compute_statistics_with_config( &self, config: StatisticsConfig, ) -> Result<DatasetStats<T>, TensorError>

Compute statistics with custom configuration
Source§

impl<T, D> DatasetUtilsExt<T> for D
where D: Dataset<T>,

Source§

fn get_multiple(&self, indices: &[usize]) -> Result<Vec<(Tensor<T>, Tensor<T>)>>

Get multiple samples by their indices
Source§

fn get_range( &self, start: usize, end: usize, ) -> Result<Vec<(Tensor<T>, Tensor<T>)>>

Get a range of samples from start (inclusive) to end (exclusive)
Source§

fn get_random(&self) -> Result<(Tensor<T>, Tensor<T>)>

Get a random sample from the dataset
Source§

fn get_random_samples( &self, count: usize, ) -> Result<Vec<(Tensor<T>, Tensor<T>)>>

Get multiple random samples from the dataset (with replacement)
Source§

impl<T, D> DatasetValidationExt<T> for D
where D: Dataset<T>, T: Clone + Default + PartialEq + PartialOrd + Display + Float + Send + Sync + 'static,

Source§

impl<T, D> DatasetVisualizationExt<T> for D
where D: Dataset<T>,

Source§

fn sample_preview(&self, num_samples: usize) -> Result<SamplePreview>
where T: Clone + Default + Zero + Send + Sync + 'static,

Create a sample preview
Source§

fn feature_distribution( &self, max_samples: Option<usize>, ) -> Result<DistributionInfo<T>>
where T: Clone + Default + Zero + Send + Sync + 'static + Float,

Get feature distribution information
Source§

fn class_distribution(&self) -> Result<ClassDistribution>
where T: Clone + Default + Zero + Send + Sync + 'static,

Get class distribution
Source§

fn feature_histogram( &self, feature_index: usize, bins: usize, ) -> Result<FeatureHistogram<T>>
where T: Clone + Default + Zero + Send + Sync + 'static + Float + PartialOrd,

Create a histogram for a specific feature
Source§

fn analyze_augmentation_effects<Tr>( &self, transform: &Tr, num_samples: usize, ) -> Result<AugmentationEffects<T>>
where T: Clone + Default + Zero + Send + Sync + 'static + Float + PartialOrd, Tr: Transform<T>,

Analyze the effects of a transform on dataset samples
Source§

impl<T, D> FederatedDatasetExt<T> for D
where D: Dataset<T>, T: Clone + Default + Send + Sync + 'static,

Source§

fn federated_client( self, config: ClientConfig, ) -> FederatedClientDataset<T, Self>

Create a federated client dataset
Source§

fn partition_federated( self, num_clients: usize, strategy: PartitioningStrategy, seed: u64, ) -> Result<Vec<FederatedClientDataset<T, ClientIndexedDataset<T, Self>>>>
where Self: Clone,

Partition dataset for federated learning
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, D> ReproducibilityExt<T> for D
where D: Dataset<T>, T: Clone + Default + Send + Sync + 'static,

Source§

fn deterministic(self, seed: u64) -> DeterministicDataset<T, Self>

Make the dataset deterministic with a seed
Source§

fn sequential(self) -> DeterministicDataset<T, Self>

Make the dataset sequential
Source§

fn reverse(self) -> DeterministicDataset<T, Self>

Make the dataset reverse ordered
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,