If I have a trained model and want to use it in production to classify new, unlabeled images in some directory, right now I cannot use an out of the box utility to load them for transformation.
As the API works right now, a user needs to either a) move all the images to a new subdirectory to conform to the nested dir structure expected by ImageFolder  or b) write some custom function as in the tutorial you provide.
If you see my github example above 1 you will see what I mean. The issue was opened in October 2017, and the last response of a user with similar needs was April 15, 2020. Clearly a subset of users need this basic functionality.  Moving millions of images every day from the root dir to a subdir to have the nested structure is a waste of time and server moneys.
Having every user do either a) or b) above seems silly imo for something that is arguably an elementary purpose of having a trained model, which is actually using it to classify unlabeled images as part of a bigger pipeline.
Something like this would be useful:
imgs = datasets.FlatImageFolder(
                non_nested_image_dir,
                transform=data_transforms)

where non_nested_image_dir is simply a dir with the images to be classified inside. Bear in mind that these images have no labels --that’s the purpose of the trained network.
Again, its not that writing a custom function is hard, but the fact that it seems such an ovious thing to have in the API and some users clearly need it (I suspect practitioners building pipelines). Hope this helps clarify what I meant.
Thanks.