code: def _collate(self, batch):
          
  
          Y_batch = None
          if isinstance(batch[0], tuple):
              batch, Y_batch = list(zip(*batch))
              Y_batch = self._cuda(torch.Tensor(Y_batch))
  
          batch, f_batch, v_batch = list(zip(*batch))
  
          f_batch, _ = pad_batch(f_batch, 0)
          v_batch, _ = pad_batch(v_batch, 0, type="float")
  
          f_batch = self._cuda(f_batch)
          v_batch = self._cuda(v_batch)
  
          X_batch = []
  
          for samples in list(zip(*batch)):
              x, x_mask = pad_batch(samples, max_len=self.settings["max_sentence_length"])
              X_batch.append((self._cuda(x), self._cuda(x_mask)))
          X_batch.extend([f_batch, v_batch])
  
          if Y_batch is not None:
              return X_batch, Y_batch
          else:
              return X_batch
docs: Puts each data field into a tensor.
  
          :param batch: The input data batch.
          :type batch: list of (word sequences, features, feature_weights) tuples
          :return: Preprocessed data.
          :rtype: list of torch.Tensor with torch.Tensor (Optional)