tfep.io.dataset.merged.MergedDataset

class tfep.io.dataset.merged.MergedDataset(*datasets)[source]

Bases: Dataset

Dataset merging multiple Datasets.

The dataset constructs a batch by merging batches from the wrapped datasets. Currently, it supports only map-style datasets that return samples in dictionary format.

Examples

>>> from tfep.io.dataset import DictDataset
>>> dataset1 = DictDataset({'a': [1., 2.]})
>>> dataset2 = DictDataset({'b': [3, 4]})
>>> merged = MergedDataset(dataset1, dataset2)
>>> merged[1]
{'a': tensor(2.), 'b': tensor(4)}
__init__(*datasets)[source]

Constructor.

Parameters:

*datasets (torch.utils.data.Dataset) – The map-style datasets to be merged. These must all have the same number of samples and return samples in dictionary format.

Methods

__init__(*datasets)

Constructor.