class_docstr: A dataset class that converts from raw data to
  a dataset that can be used by DataLayerNM.
  Args:
      input_file: file to sequence + label.
          the first line is header (sentence [tab] label)
          each line should be [sentence][tab][label]
      tokenizer: tokenizer object such as AutoTokenizer
      max_seq_length: max sequence length minus 2 for [CLS] and [SEP]
      num_samples: number of samples you want to use for the dataset.
          If -1, use all dataset. Useful for testing.
      shuffle: Shuffles the dataset after loading.
      use_cache: Enables caching to use pickle format to store and read data from
docstr: collate batch of input_ids, segment_ids, input_mask, and label
  Args:
      batch:  A list of tuples of (input_ids, segment_ids, input_mask, label).
docstr_tok: ["collate","batch","of","input_ids",",","segment_ids",",","input_mask",",","and","label","Args",":","batch",":","A","list","of","tuples","of","(","input_ids",",","segment_ids",",","input_mask",",","label",")","."]
code: def _collate_fn(self, batch):
      """collate batch of input_ids, segment_ids, input_mask, and label
      Args:
          batch:  A list of tuples of (input_ids, segment_ids, input_mask, label).
      """
      max_length = 0
      for input_ids, segment_ids, input_mask, label in batch:
          if len(input_ids) > max_length:
              max_length = len(input_ids)
  
      padded_input_ids = []
      padded_segment_ids = []
      padded_input_mask = []
      labels = []
      for input_ids, segment_ids, input_mask, label in batch:
          if len(input_ids) < max_length:
              pad_width = max_length - len(input_ids)
              padded_input_ids.append(
                  np.pad(
                      input_ids,
                      pad_width=[0, pad_width],
                      constant_values=self.pad_id,
                  )
              )
              padded_segment_ids.append(
                  np.pad(
                      segment_ids,
                      pad_width=[0, pad_width],
                      constant_values=self.pad_id,
                  )
              )
              padded_input_mask.append(
                  np.pad(
                      input_mask,
                      pad_width=[0, pad_width],
                      constant_values=self.pad_id,
                  )
              )
          else:
              padded_input_ids.append(input_ids)
              padded_segment_ids.append(segment_ids)
              padded_input_mask.append(input_mask)
          labels.append(label)
  
      return (
          torch.LongTensor(padded_input_ids),
          torch.LongTensor(padded_segment_ids),
          torch.LongTensor(padded_input_mask),
          torch.LongTensor(labels),
      )
  
imports: import os
  import pickle
  import random
  from typing import Dict, List, Optional
  import numpy
  import torch
  from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec
  from nemo.collections.nlp.data.data_utils.data_preprocessing import fill_class_weights, get_freq_weights, get_label_stats, get_stats
  from nemo.collections.nlp.parts.utils_funcs import list2str
  from nemo.core.classes import Dataset
  from nemo.core.neural_types import ChannelType, LabelsType, MaskType, NeuralType
  from nemo.utils import logging
  from nemo.utils.env_var_parsing import get_envint
label_desc: Use image node_id 5 for calling the TextClassificationDataset obj's underlying member method code with example usage: obj._collate_fn(batch) and returns: torch,  torch,  torch,  torch