openfl.federated.data.loader_gandlf.GaNDLFDataLoaderWrapper
- class openfl.federated.data.loader_gandlf.GaNDLFDataLoaderWrapper(data_path, feature_shape)
Bases:
DataLoaderA class used to represent a data loader for the Generally Nuanced Deep Learning Framework (GaNDLF).
- Class Attributes:
train_csv (str) – Path to the training CSV file.
val_csv (str) – Path to the validation CSV file.
train_dataloader (DataLoader) – DataLoader object for the training data.
val_dataloader (DataLoader) – DataLoader object for the validation data.
feature_shape (tuple) – Shape of an example feature array.
Methods
Returns the shape of an example feature array.
Returns the data loader for inferencing data.
Returns the total number of training samples.
Returns the data loader for the training data.
Returns the total number of validation samples.
Returns the data loader for the validation data.
Sets the data loaders for the training and validation data.
- get_feature_shape()
Returns the shape of an example feature array.
- Returns:
tuple – The shape of an example feature array.
- get_infer_loader()
Returns the data loader for inferencing data.
- Raises:
NotImplementedError – This method must be implemented by a child class.
- get_train_data_size()
Returns the total number of training samples.
- Returns:
int – The total number of training samples.
- get_train_loader(batch_size=None, num_batches=None)
Returns the data loader for the training data.
- Parameters:
batch_size (int, optional) – The batch size for the data loader (default is None).
num_batches (int, optional) – The number of batches for the data loader (default is None).
- Returns:
DataLoader – The DataLoader object for the training data.
- get_valid_data_size()
Returns the total number of validation samples.
- Returns:
int – The total number of validation samples.
- get_valid_loader(batch_size=None)
Returns the data loader for the validation data.
- Parameters:
batch_size (int, optional) – The batch size for the data loader (default is None).
- Returns:
DataLoader – The DataLoader object for the validation data.
- set_dataloaders(train_dataloader, val_dataloader)
Sets the data loaders for the training and validation data.
- Parameters:
train_dataloader (DataLoader) – The DataLoader object for the training data.
val_dataloader (DataLoader) – The DataLoader object for the validation data.