you need to write a custom collate_fn and pass it to your data loader. Questions about Dataloader and Dataset