Dataset Collation and Loaders #
In-memory collation, fixed-size batching, and epoch traversal.
Build a supervised dataset from two matrices X : n×inDim and Y : n×outDim by pairing rows.
This is the simple regression case of a tensor dataset.
Instances For
Collate a length-n supervised batch into a single sample with a leading batch axis.
If your samples are (x : σ, y : τ), the collated sample is:
xBatch : (n × σ)andyBatch : (n × τ)
In shapes: TensorPack α [dim n σ, dim n τ].
Instances For
Turn a per-sample supervised dataset into a dataset of fixed-size minibatches.
This is useful for metrics (meanLossDataset, accuracy, etc.) when your model expects a leading
batch axis.
Notes:
- This drops the final partial batch (PyTorch
drop_last=Truebehavior). - Batches are formed in dataset order (shuffling is the loader's job).
Instances For
Extract the underlying per-sample dataset from a typed BatchLoader.
Instances For
The batch size n carried in the type of a BatchLoader.
Instances For
Whether the loader is configured to shuffle samples each epoch.
Instances For
RNG seed used for shuffling (if enabled).
Instances For
Materialize the dataset as a dataset of full minibatches (dropping any final partial batch).
Instances For
Run one epoch: return the updated loader state and a list of typed minibatches.
Instances For
Like epoch, but post-process each minibatch with a user-supplied collate/transform f.
Instances For
Run one epoch and require at least one full typed minibatch.
This is the shared checked boundary for examples that need a nonempty list of full batches. It keeps the "drop partial batches, but fail if nothing remains" policy with the loader API rather than repeating it in each dataset-specific helper.
Instances For
Run one epoch and return its first full typed minibatch.
Instances For
Public loader API: supervised datasets become fixed-size minibatch loaders by default.
The underlying dataset still stores individual samples; the loader batches them and epoch
returns tensors with a leading batch axis. Because the batch size is reflected in the type,
the public batched path requires full batches, so dropLast defaults to true.
Instances For
Load a numeric supervised CSV and immediately wrap it as a typed minibatch loader.
The CSV convention is the same as TabularSupervisedSource: each row contains inDim feature
columns followed by outDim target columns. This belongs in the data API rather than in an
individual model file because tabular examples, benchmarks, and downstream users all need the same
operation: CSV -> typed dataset -> shuffled minibatch loader.
Instances For
Build a batch loader when the batch size is only known at runtime.