torchdatasets icon indicating copy to clipboard operation
torchdatasets copied to clipboard

Multiple concatenation with logical or operator yields nested concatenation

Open w-m opened this issue 3 years ago • 0 comments

Concatenation of two datasets with the logical operator works as intended: concat_2 = images | images

While concatenation of more datasets (concat_3 = images | images | images) yields a nested concatenated dataset.

The code is equivalent to: concat_3 = torchdata.datasets.ConcatDataset([torchdata.datasets.ConcatDataset([images, images]), images])

I'd argue a more intuitive result would something that is equivalent to this instead: concat_3 = torchdata.datasets.ConcatDataset([images, images, images])

In short, concatenating with the | operator to an already concatenated dataset should add the new dataset in the list of concatenations, instead of creating a nested concatenated dataset.

w-m avatar Sep 15 '21 17:09 w-m