dataloaders
PyTorch-specific DataLoader implementations.
Module
Global variables
DEFAULT_BUFFER_SIZE : int
- The default buffer size for shuffling Iterable Datasets.
Classes
PyTorchBitfountDataLoader
class PyTorchBitfountDataLoader( dataset: _BitfountDataset, batch_size: int = 1, shuffle: bool = False,):
Wraps a PyTorch DataLoader with bitfount functions.
Arguments
batch_size
: The batch size for the dataloader. Defaults to 1.dataset
: An pytorch compatible dataset.shuffle
: A boolean value indicating whether the values in the dataset should be shuffled. Defaults to False.
Attributes
batch_size
: The batch size for the dataloader. Defaults to 1.shuffle
: A boolean value indicating whether the values in the dataset should be shuffled. Defaults to False.
Ancestors
- bitfount.backends.pytorch.data.dataloaders._BasePyTorchBitfountDataLoader
- BitfountDataLoader
Methods
expect_key_in_iter
def expect_key_in_iter(self) ‑> bool:
Will there be a data key entry in the output from iteration?
get_pytorch_dataloader
def get_pytorch_dataloader(self, **kwargs: Any) ‑> torch.utils.data.dataloader.DataLoader:
Return a PyTorch DataLoader for self.dataset
.
Keyword arguments are passed to PyTorch's DataLoader constructor and take precedence over the values set in the constructor.
PyTorchIterableBitfountDataLoader
class PyTorchIterableBitfountDataLoader( dataset: _IterableBitfountDataset, secure_rng: bool = False, batch_size: int = 1, shuffle: bool = False,):
Wraps a PyTorch DataLoader with bitfount functions.
Arguments
batch_size
: The batch size for the dataloader. Defaults to 1.dataset
: An iterable dataset.secure_rng
: A boolean value indicating whether to use a secure random number generator. Defaults to False.shuffle
: A boolean value indicating whether the values in the dataset should be shuffled. Defaults to False.
Attributes
batch_size
: The batch size for the dataloader. Defaults to 1.secure_rng
: A boolean value indicating whether to use a secure random number generator. Defaults to False.shuffle
: A boolean value indicating whether the values in the dataset should be shuffled. Defaults to False.
Ancestors
- bitfount.backends.pytorch.data.dataloaders._BasePyTorchBitfountDataLoader
- BitfountDataLoader
Methods
expect_key_in_iter
def expect_key_in_iter(self) ‑> bool:
Will there be a data key entry in the output from iteration?