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