If you are using a batch size of 1, the collate_fn will “stack” the single sample to a batch, i.e. it will just add the batch dimension to the sample and return it without trying to stack several samples to a single batch.