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.