Can sampler return other things besides indicies e.g. tensor of size M K*N C H W?

Docs say:

sampler ( Sampler , optional ) – defines the strategy to draw samples from the dataset. If specified, shuffle must be False .

but I want it to work with multithreading properly. My data-set is a data-set of data sets so I want to create a sampler that simply sampled my meta set correctly.

 e.g. tensor of size M K*N C H W

The sampler will return indices, which will be passed to the Dataset.__getitem__ method.
The returned tensor shape from your dataset is thus unrelated to the sampler.

You can see the implementations (and the return values in __iter__) for the samplers here.

If your tensors are stored in the specified shape [M, K*N, C, H, W] inside your Dataset, you should be able to return them in this shape.

The DataLoader would add a batch dimension to these tensors. I don’t know what the specified shapes mean, but if N is the batch size, you could set batch_size=1 in the DataLoader and squeeze dim0 in the DataLoader loop.

This is for N-way K-shot learning.

So (meta) batch size is M.