I’m not sure I understand your use case completely.



 Rakuen:

I thought loading my values in each pixel (let’s say pressure or velocity) instead of loading image would be more practical but as i understand correctly it can’t be done with the shape of [n, n].


Would you like to load each pixel value individually and pass it as a single value to your model?
That would be possible, so let me know, if that’s really your use case.



 Rakuen:

Can you give me an example of data format that i should pass dataset if it isn’t too much for you?


Sure! I would suggest to use my first example and pass a list of paths to your .mat files as the arguments to __init__:
class MyMatDataset(Dataset):
    def __init__(self, image_paths, target_paths):
        self.image_paths = image_paths
        self.target_paths = target_paths
        
    def __getitem__(self, index):
        x = scipy.io.loadmat(self.image_paths[index])
        x = torch.from_numpy(x['MD'])
        y = scipy.io.loadmat(self.target_paths[index])
        y = torch.from_numpy(y['z1'])

        return x, y

    def __len__(self):
        return len(self.image_paths)

# Create your data and target paths and make sure the order is right
image_paths = ['./ames01.mat', './ames02.mat', ...]
target_paths = ['./ames01_target.mat', './ames02_target.mat', ...]
dataset = MyMatDataset(image_paths, target_paths)
loader = DataLoader(dataset)