syft.frameworks.torch.fl.dataset

Module Contents

syft.frameworks.torch.fl.dataset.logger
class syft.frameworks.torch.fl.dataset.BaseDataset(data, targets, transform=None)

This is a base class to be used for manipulating a dataset. This is composed of a .data attribute for inputs and a .targets one for labels. It is to be used like the MNIST Dataset object, and is useful to avoid handling the two inputs and label tensors separately.

Parameters
  • tensors] (data[list,torch) – the data points

  • targets – Corresponding labels of the data points

  • transform – Function to transform the datapoints

fix_precision
float_precision
__len__(self)
__getitem__(self, index)
Parameters

index[integer] – index of item to get

Returns

Data points corresponding to the given index targets: Targets correspoding to given datapoint

Return type

data

transform(self, transform)

Allows a transform to be applied on given dataset. :param transform: The transform to be applied on the data

send(self, worker)
Parameters

class] (worker[worker) – worker to which the data must be sent

Returns

Return the object instance with data sent to corresponding worker

Return type

self

get(self)

Gets the data back from respective workers.

fix_prec(self, *args, **kwargs)

Converts data of BaseDataset into fixed precision

float_prec(self, *args, **kwargs)

Converts data of BaseDataset into float precision

share(self, *args, **kwargs)

Share the data with the respective workers

property location(self)

Get location of the data

syft.frameworks.torch.fl.dataset.dataset_federate(dataset, workers)

Add a method to easily transform a torch.Dataset or a sy.BaseDataset into a sy.FederatedDataset. The dataset given is split in len(workers) part and sent to each workers

syft.frameworks.torch.fl.dataset.federate
syft.frameworks.torch.fl.dataset.federate
class syft.frameworks.torch.fl.dataset.FederatedDataset(datasets)
property workers(self)

Returns: list of workers

__getitem__(self, worker_id)
Parameters

worker_id[str,int] – ID of respective worker

Returns: Get Datasets from the respective worker

__len__(self)
__repr__(self)