How to use a .mat file with all my data in pytorch

First of all, sorry if the question was answered before but I couldn’t find anything specific to my case (noob here).

I have a .mat file where I have a matrix 100x100x10000, representing 10000 different images of 100x100.
I wanted to use this .mat file in pytorch and create a dataset of it so then I could use it in DataLoader.

I wanted to test this dataset in a GAN architecture that was provided to me but I got stuck right on step one. I’m really giving my first steps here… So, sorry for that.
Any help would be much appreciated!


I guess you can use tools like to load the mat file into a numpy array and then move that to pytorch (copyless) with torch.from_numpy(your_array).