class_docstr: Dataset class for classifiers from Transformers Integration.
      
class_docstr_tok: ["Dataset","class","for","classifiers","from","Transformers","Integration","."]
code: def y(self, y):
      expected_num_samples = len(self.data)
      if self.multi_label:
          num_samples = y.indptr.shape[0] - 1
          check_size(expected_num_samples, num_samples)
  
          for i, p in enumerate(range(num_samples)):
              self._data[i] = (
                  self._data[i][self.INDEX_TEXT],
                  self._data[i][self.INDEX_MASK],
                  y.indices[y.indptr[p] : y.indptr[p + 1]],
              )
      else:
          num_samples = y.shape[0]
          check_size(expected_num_samples, num_samples)
  
          for i, _y in enumerate(y):
              self._data[i] = (
                  self._data[i][self.INDEX_TEXT],
                  self._data[i][self.INDEX_MASK],
                  _y,
              )
  
      if self.track_target_labels:
          self.target_labels = get_updated_target_labels(
              self.is_multi_label, y, self.target_labels
          )
      else:
          max_label_id = get_num_labels(y) - 1
          max_target_labels_id = self.target_labels.max()
          if max_label_id > max_target_labels_id:
              raise ValueError(
                  f"Error while assigning new labels to dataset: "
                  f"Encountered label with id {max_label_id} which is outside of "
                  f"the configured set of target labels (whose maximum label is "
                  f"is {max_target_labels_id}) [track_target_labels=False]"
              )
  
imports: import numpy
  from scipy.sparse import csr_matrix
  from small_text.base import LABEL_UNLABELED
  from small_text.data.datasets import check_size, check_target_labels, get_updated_target_labels
  from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
  from small_text.utils.annotations import experimental
  from small_text.utils.labels import csr_to_list, get_num_labels, list_to_csr
label_desc: Use image node_id 7 for calling the TransformersDataset obj's underlying member method code with example usage: obj.y(y) without return types