To be more specific, it uses the ImageFolder 12 Dataset from torchvision.
This special dataset is such that when a given element is required, it loads it from disk then return it (with some tricks to make this fast).
You will need your dataset to be layed out on disk as expected by the dataset (see the doc for what it expects).