Small, self-contained PyTorch datasets that generate random samples on-the-fly for quick experiments and testing.
- Random regression data:
(x, y)from standard normal - Random grayscale image classification data: image values in
[0, 1], integer labels - Deterministic per-index sampling with an optional
seed - Configurable number of samples
from random_dataset import RandomRegressionDataset, RandomImageDataset
# Regression: x in R^m, y in R^n
reg = RandomRegressionDataset(num_samples=10_000, input_size=16, output_size=3, seed=42)
x, y = reg[0]
# Grayscale image classification: (1, H, W) image, integer label
img = RandomImageDataset(num_samples=50_000, image_size=28, num_classes=10, seed=42)
image, label = img[0]python -m unittest test_imports.pyrandom_dataset/ # Package root
├─ __init__.py # Re-exports the public API
├─ core.py # Dataset implementations
├─ test_imports.py # Minimal unittest for import & basic access
└─ README.md # This file
- Python 3.9+
- PyTorch (
torch)
EUPL-1.2. See the LICENSE file or https://eupl.eu/1.2/en/ for details.