Ratan:

My question is how will ImageFolder() divide the images into train,test from EACH class folder as given above??


It won’t divide the folders automatically. ImageFolder takes the root folder as an argument and will use all images from all subfolders as data samples.
To split the dataset, you could use torch.utils.data.random_split, torch.utils.data.Subset passing the indices, or torch.utils.data.sampler.SubsetRandomSampler also passing the indices.



 Ratan:

My question is how will ImageFolder() divide the images into train,test from EACH class folder as given above??


ImageFolder will sort all subfolders and assign a class label to each of them as seen in these lines of code 60.