class_docstr: The NumPy data type Enum for writing/reading the MMapIndexedDataset indices
      
class_docstr_tok: ["The","NumPy","data","type","Enum","for","writing\/reading","the","MMapIndexedDataset","indices"]
docstr: Get the dtype to use for an index of a certain cardinality
  
  Args:
      cardinality (Optional[int]): The number of elements to be indexed
  
  Returns:
      Type[numpy.number]: The dtype to use for the index
docstr_tok: ["Get","the","dtype","to","use","for","an","index","of","a","certain","cardinality","Args",":","cardinality","(","Optional","[","int","]",")",":","The","number","of","elements","to","be","indexed","Returns",":","Type","[","numpy.number","]",":","The","dtype","to","use","for","the","index"]
code: def optimal_dtype(cardinality: Optional[int]) -> Type[numpy.number]:
      """Get the dtype to use for an index of a certain cardinality
  
      Args:
          cardinality (Optional[int]): The number of elements to be indexed
  
      Returns:
          Type[numpy.number]: The dtype to use for the index
      """
      if cardinality is not None and cardinality < 65500:
          return numpy.uint16
      else:
          return numpy.int32
  
imports: import logging
  import os
  import shutil
  import struct
  import time
  from enum import Enum
  from functools import lru_cache
  from itertools import accumulate
  from types import TracebackType
  from typing import List, Optional, Tuple, Type, Union
  import numpy
  import torch
  from megatron.core.datasets.utils import log_single_rank
label_desc: Use image node_id 4 for calling the DType obj's underlying member method code with example usage: obj.optimal_dtype(cardinality) and returns: numpy, numpy