Class - GaNDLFDataLoaderWrapper#

class openfl.federated.data.loader_gandlf.GaNDLFDataLoaderWrapper(data_path, feature_shape)[source]#

Bases: DataLoader

A 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:

DataLoader

val_dataloader#

DataLoader object for the validation data.

Type:

DataLoader

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.

get_feature_shape()

Returns the shape of an example feature array.

get_infer_loader()

Returns the data loader for inferencing data.

get_train_data_size()

Returns the total number of training samples.

get_train_loader([batch_size, num_batches])

Returns the data loader for the training data.

get_valid_data_size()

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:

DataLoader

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:

DataLoader

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.