Hi. @ptrblck I created the data loader by using the referenced function. but my data is not divided into batches while training.(mat file contain: complex128)
(one thing I don’t understand I am unable to define batch size greater than path length.)
‘’’
import scipy.io as io
class MyDataset(Dataset):
def init(self, mat_paths,col_name,transform):
self.paths = mat_paths
    self.matX = io.loadmat(self.paths)[col_name]

    self.transform = transform
def __getitem__(self, index):
  
    X = self.matX[index].astype(np.float32)
   
    X = torch.from_numpy(X)
    X = abs(X)

    return X

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

mat_paths = (r’C:\Users\Abhi\Downloads\dataset\outputs\images\train1.mat’)
trainDataset = MyDataset(mat_paths,‘train4’,transform=transform)
trainLoader = DataLoader(trainDataset, batch_size=32, shuffle=True, num_workers=0, pin_memory=True,drop_last=True)
‘’’