syna.utils.dataloaders module¶
Data loader utilities.
Provides simple iterable data loaders used by training loops: a batched DataLoader and a sequence-aware SeqDataLoader.
- class syna.utils.dataloaders.DataLoader(dataset: Iterable[Tuple[Any, Any]], batch_size: int, shuffle: bool = True)[source]¶
Bases:
object
Simple iterable data loader.
- Args:
dataset: Sequence of (input, target) pairs. batch_size: Number of samples per batch. shuffle: If True, shuffle dataset order at the start of each epoch.
- Behavior:
Iterates over dataset in batches. The last batch may be smaller.
Iteration raises StopIteration at epoch end and automatically resets for the next epoch.
- class syna.utils.dataloaders.SeqDataLoader(dataset: Iterable[Tuple[Any, Any]], batch_size: int)[source]¶
Bases:
DataLoader
Sequence-aware loader that yields batch_size sequences in parallel.
The loader divides the dataset into batch_size streams by computing a ‘jump’ = data_size // batch_size and, for each iteration step k, takes the elements at positions (i*jump + k) % data_size for i in range(batch_size).
- Args:
dataset: Sequence of (input, target) pairs. batch_size: Number of parallel sequences (streams) per batch.
- Behavior:
shuffle is always disabled for sequence loader.
Iteration yields exactly data_size // jump steps (i.e., max_iter inherited).