How to load data from .dat files classified by folders

Hello,

I stored my data in .dat files as matrices and I classified them in folders (i.e. ‘A’, ‘B’, etc.).
How can I load them in order to use them in dataloader. Is there any function like torchvision.datasets.ImageFolder to load this data and automatically assign a target class ?

You could use DatasetFolder with a custom loader class which should be able to load the .dat format. This post shows how it’s done for numpy arrays.

Thank you so much. It worked wonderfully.