blazefl.core.PartitionedDataset#
- class blazefl.core.PartitionedDataset(*args, **kwargs)[source]#
Bases:
Protocol
[PartitionType
]Abstract base class for partitioned datasets in federated learning.
This class defines the interface for managing datasets that are partitioned across multiple clients.
- Raises:
NotImplementedError – If the methods are not implemented in a subclass.
- __init__(*args, **kwargs)#
Methods
__init__
(*args, **kwargs)get_dataloader
(type_, cid, batch_size, generator)Retrieve a DataLoader for a specific type, client ID, and batch size.
get_dataset
(type_, cid)Retrieve a dataset for a specific type and client ID.
set_dataset
(type_, cid, dataset)Set a dataset for a specific type and client ID.
- get_dataloader(type_: PartitionType, cid: int | None, batch_size: int | None, generator: Generator | None) DataLoader [source]#
Retrieve a DataLoader for a specific type, client ID, and batch size.
- Parameters:
type (str) – The type of the dataset.
cid (int | None) – The client ID.
batch_size (int | None) – The batch size.
generator (Generator | None) – Optional random number generator for shuffling.
- Returns:
The DataLoader.
- Return type:
DataLoader