How to make a dataloader with a directory of subfolders relevant to each class

I have a dataset that contains images of brain tumoursl. I want to make a CNN to classify these images.What I have seen is a directory of images which is separated in “train” , “test” folders.

However, in this case, the dataset directory structure is as follows.
dataset_dir
|_____tumor_type_1
|_____tumor_type_2
|_____tumor_type_3
|_____no_tumor

Now, I want to make 3 dataloaders. ( a train_dataloader,a validation_dataloader & a test_dataloader.)
Does anyone know how to do this in PyTorch.

You could use the torchvision.datasets.ImageFolder class for the datasets, create the splits via torch.utils.data.Subsets, and wrap them in DataLoaders.