Data Loader is not loading the csv file in pytorch

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(
    def __init__(self, files):
        self.files = files
        print("FILES: ", type(self.files))
    def __getitem__(self, i):

        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
        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'>

Even when I run this:

train_loader =
        train_dl_spec, batch_size=8, shuffle=True, num_workers=1, pin_memory=True)

I get no output. What should I do?

Source: Python-3x Questions