Backends (pymia.data.backends package)

PyTorch

class pymia.data.backends.pytorch.PytorchDatasetAdapter(*args: Any, **kwargs: Any)[source]

A wrapper class for PymiaDatasource to fit the torch.utils.data.Dataset interface.

Parameters:

datasource (.PymiaDatasource) – The pymia datasource instance.

class pymia.data.backends.pytorch.SubsetSequentialSampler(*args: Any, **kwargs: Any)[source]

Samples elements sequential from a given list of indices, without replacement.

The class adopts the torch.utils.data.Sampler interface.

Parameters:

list (indices) – list of indices that define the subset to be used for the sampling.

TensorFlow

pymia.data.backends.tensorflow.get_tf_generator(data_source: PymiaDatasource)[source]

Returns a generator that wraps PymiaDatasource for the TensorFlow data handling.

The returned generator can be used with tf.data.Dataset.from_generator in order to build a TensorFlow dataset.

Parameters:

data_source (.PymiaDatasource) – the datasource to be wrapped.

Returns:

Function that loops over the entire datasource and yields all entries.

Return type:

generator