Can anyone tell me what mistake I’m making here? My error message is:
     22         # Load data and get label
     23         X = torch.sparse.FloatTensor(
---> 24             torch.LongTensor([self.i[ID]]),
     25             torch.FloatTensor(self.v[ID]),
     26             torch.Size([self.vecSize])

RuntimeError: sizes must be non-negative

I did of course check that none of the values in self.i.[ID] are negative…
This results from calling my dataGenerator at Epoch [1/5], Step [33/2814] :
    for local_batch, local_labels in training_generator:
       #a batch training step

Below is definition of my dataset, the main challenge of which is converting from PySpark sparse vectors to tensors.
from torch.utils import data

class Dataset(data.Dataset):
  def __init__(self, list_IDs, labels, indices,values,vecSize):

        #all inputs except list_IDs are dictionaries keyed to ID

        'Initialization'
        self.labels = labels
        self.list_IDs = list_IDs
        self.i= indices
        self.v =values
        self.vecSize=vecSize

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

  def __getitem__(self, index):
        # Select sample
        ID = self.list_IDs[index]

        # Load data and get label
        X = torch.sparse.FloatTensor(
            torch.LongTensor([self.i[ID]]),
            torch.FloatTensor(self.v[ID]), 
            torch.Size([self.vecSize])
        ).to_dense()
        i = self.labels[ID]

        return X, torch.LongTensor([i])
    
training_set = Dataset(partition['train'], labels_train,i_train,v_train,inputSize)
training_generator = data.DataLoader(training_set, **params)

In the spirit of citation, this code is heavily influenced by: https://stanford.edu/~shervine/blog/pytorch-how-to-generate-data-parallel 3