Image Folder with no subfolders

Considering that testing images are in most cases not categorized into classes as train images are, does pytorch have a way of loading such images or do I have to write a custom loop to load all of them.