Hi eveyone,
I’m working with a custom Dataset and BatchSampler. Due to the nature of my data, I have to fetch batches of different sizes, that’s why I’m using a CustomBatchSampler. Because of this, DataLoaders try to fetch items from my CustomDataset one item at each time.

As you can see here 25, if I provide a batch_sampler to a DataLoader, self.auto_collation becomes True.
Then, because self.auto_collation is True, items are fetched one by one, as you can see here 9.

As a consequence, my code is faster if I iterate over my CustomBatchSampler and fetch multiple items manually, instead of using a DataLoader. I built my Dataset to support fetching multiple indexes at once. Also, I lose the possibility of using multiple workers easily (using a DataLoader as is).
Is it possible to force a DataLoader to fetch multiple items at once, like data = self.dataset[possibly_batched_index]? (like when self.auto_collation is False, in the second link). Is there a different approach expected to consider when using a CustomBatchSampler inside a DataLoader?
Thanks!