Batching¶
Utilities for batching and shuffling simulation datasets.
combine_datasets ¶
combine_datasets(datasets)
Concatenate multiple datasets into one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
datasets
|
Sequence[SimulationDataset]
|
List of datasets to concatenate. |
required |
Returns:
| Type | Description |
|---|---|
SimulationDataset
|
Combined dataset with entries stacked along the batch dimension. |
iterate_minibatches ¶
iterate_minibatches(
dataset, batch_size, *, drop_last=False
)
Yield mini-batches from a dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
SimulationDataset
|
Source dataset. |
required |
batch_size
|
int
|
Number of samples per batch. |
required |
drop_last
|
bool
|
Whether to drop the final incomplete batch. |
False
|
Yields:
| Type | Description |
|---|---|
SimulationDataset
|
Mini-batch of the dataset. |
shuffle_dataset ¶
shuffle_dataset(dataset, seed=None)
Shuffle dataset entries along the batch dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
SimulationDataset
|
Dataset to shuffle. |
required |
seed
|
int
|
Optional seed for reproducible shuffling. |
None
|
Returns:
| Type | Description |
|---|---|
SimulationDataset
|
Shuffled dataset. |