I have multiple csv files which contain 1D data and I want to use each row. Each file contains different number of rows. So I have written a dataloader like this:
class data_gen(torch.utils.data.Dataset):
    def __init__(self, files):
        
        self.files = files
        print("FILES: ", type(self.files))
        
    def __getitem__(self, i):

        print("GETite,")
        
        file1 = self.files[i]
        print("FILE1: ", file1)
        my_data = np.genfromtxt('/data/'+file1, delimiter=',')
        
        # file1 = np.reshape(file1,(1,len(file1)))
        # file1 = torch.from_numpy(file1).float()
        
        # return data
        print(len(my_data))
        return my_data

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

However, when I call it like this:
train_dl_spec = data_gen(train_files[0])

I get the following output:
FILES:  <class 'str'>

It’s not processing __getitem__ for some reason. What could be the reason?