quanda.utils.datasets.on_device_dataset module¶
Module to move a dataset to a device.
- class quanda.utils.datasets.on_device_dataset.OnDeviceDataset(dataset: Dataset, device: str | device)[source]¶
Bases:
DatasetWrapper that moves a dataset’s tensors to a target device.
Handles arbitrary sample structures returned by
dataset[i]— single tensor, tuple/list of any length, dict — by recursively moving every tensor leaf while leaving non-tensor values untouched.