This error is raised in the collate_fn which tries to create a batch of multiple samples.
Since each sample has a different shape, torch.stack will fail.
If you want to iterate each slice of a single sample, you could thus set batch_size=1 and it should work.