TensorDataset accepts tensors as input. So, CustomDataset can’t be its parameter.
Why can’t you pass labels to custom dataset and return image, label in __getitem__?
and then pass the CustomDataset directly to dataloader?