class_docstr: DGL datatype structure
code: def __new__(cls, type_str):
      if type_str in cls._cache:
          return cls._cache[type_str]
  
      inst = super(DGLDataType, cls).__new__(DGLDataType)
  
      if isinstance(type_str, np.dtype):
          type_str = str(type_str)
      arr = type_str.split("x")
      head = arr[0]
      inst.lanes = int(arr[1]) if len(arr) > 1 else 1
      bits = 32
  
      if head.startswith("int"):
          inst.type_code = 0
          head = head[3:]
      elif head.startswith("uint"):
          inst.type_code = 1
          head = head[4:]
      elif head.startswith("float"):
          inst.type_code = 2
          head = head[5:]
      elif head.startswith("handle"):
          inst.type_code = 4
          bits = 64
          head = ""
      else:
          raise ValueError(
              "Do not know how to handle type %s" % type_str
          )
      bits = int(head) if head else bits
      inst.bits = bits
  
      cls._cache[type_str] = inst
      return inst
  
imports: from __future__ import absolute_import
  import ctypes
  import json
  import numpy
  from ..None import _api_internal
  from .base import _LIB, check_call
label_desc: Use image node_id 1 for calling the DGLDataType obj's underlying member method code with example usage: obj.__new__(cls, type_str) and returns: inst, cls