This is my dataloader class:
class Dataset(torch.utils.data.Dataset):
  'Characterizes a dataset for PyTorch'
  def __init__(self, list_IDs, tensorDict,GTDict):
        'Initialization'
        self.list_IDs = list_IDs
        self.tensorDict=tensorDict
        self.GTDict=GTDict
  def __len__(self):
        'Denotes the total number of samples'
        return len(self.list_IDs)

  def __getitem__(self, index):
        'Generates one sample of data'
        # Select sample
        key = self.list_IDs[index]

        # Load data and get label
        X = torch.load(self.tensorDict[key])
        y = cv2.imread(self.GTDict[key])
        return X, y

So yes, i’m returning a tuple of x,y but then i split it also
training_set = Dataset(listIDs['train'],tensors['train'],groundTruth['train'])
training_generator = torch.utils.data.DataLoader(training_set, **params['train'],batch_size=1)
while(stopTraining):
    for inputForNetwork,outputFromNetwork in training_generator:
        out=model.forward(inputForNetwork)

i printed it out before i use inputForNetwork in network Forward() method, the output is at my previous post,
First i did not used batch_size=1 but then i was receiving error that i need 4 dimensions not 3
i’m loading my tensors like this:
    statsAboutFile=[]
    for typeOfStatistics in parameters.stats:
        fullNameOfFile=shortenedNameOfFile+typeOfStatistics+".csv"
        dataOriginal=pd.read_csv(fullNameOfFile, index_col =False,header = None).astype('float')
        torch_tensor=torch.tensor(dataOriginal.values)
        torch_tensor=torch_tensor.float()
        statsAboutFile.append(torch_tensor)
    return torch.stack(statsAboutFile)

then with this returned i use only torch.save(), and then torch.load() in getitem()