thank you Sergey. You helped me a lot. I was able to achieve the result with a few changes. I will leave the code for those who may see it later.
class MYDATASET(data.Dataset):
    def __init__(self, mat_paths, transform=None):

        self.mat_paths = '/dataset/Train48d48.mat'
        self.data = io.loadmat(mat_paths)
        self.transform = transform

    def __getitem__(self, index):
        x = self.data['image_data'][index]
        y = np.squeeze(self.data['image_labels'])[index]

        if self.transform :
            x = self.transform(x)     
        return x, y

    def __len__(self):
        return len(self.data['image_data'])

transform = transforms.Compose([
    transforms.ToPILImage(),
    transforms.ToTensor()
])

trainset = MYDATASET(
    mat_paths='/dataset/Train48d48.mat', transform=transform)

trainloader = torch.utils.data.DataLoader( trainset, batch_size=128, shuffle=True)