code: def ConstantNode(device, value, dtype, shape, layout, **kwargs):
      data = value
      if _is_compatible_array_type(value):
          value = _preprocess_constant_array_type(value)
  
          # At this point value is a numpy array or a torch tensor. They have very similar API
          actual_type = to_dali_type(value.dtype)
          if dtype is None:
              dtype = actual_type
          if shape is not None:
              value = value.reshape(shape)
          else:
              shape = list(
                  value.shape
              )  # torch uses torch.Size instead of list
          data = value.flatten().tolist()
      else:
  
          def isseq(v):
              return isinstance(v, (list, tuple))
  
          if shape is None:
              shape = (len(value),) if isseq(value) else ()
  
          def _type_from_value_or_list(v):
              if not isseq(v):
                  v = [v]
  
              has_floats = False
              has_ints = False
              has_bools = False
              for x in v:
                  if isinstance(x, float):
                      has_floats = True
                  elif isinstance(x, bool):
                      has_bools = True
                  elif isinstance(x, int):
                      has_ints = True
                  else:
                      raise TypeError(
                          "Unexpected type: " + str(type(x))
                      )
  
              if has_floats:
                  return DALIDataType.FLOAT
              if has_ints:
                  return DALIDataType.INT32
              if has_bools:
                  return DALIDataType.BOOL
              # empty list defaults to float
              return DALIDataType.FLOAT
  
          actual_type = _type_from_value_or_list(value)
          if dtype is None:
              dtype = actual_type
  
      import nvidia.dali.fn as fn
  
      def _convert(x, type):
          if isinstance(x, (list, tuple)):
              return [type(y) for y in x]
          return type(x)
  
      isint = actual_type in _int_like_types
      idata = _convert(data, int) if isint else None
      fdata = None if isint else data
      if device is None:
          device = "cpu"
  
      return fn.constant(
          device=device,
          fdata=fdata,
          idata=idata,
          shape=shape,
          dtype=dtype,
          layout=layout,
          **kwargs,
      )
  
imports: from enum import Enum, unique
  import re
  from nvidia.dali._backend_enums import DALIDataType, DALIImageType, DALIInterpType
  from nvidia.dali.backend_impl.types import *
label_desc: Use image node_id 20 for calling a global function with example usage: ConstantNode(device, value, dtype, shape, layout) and returns: fn, type, isinstance, DALIDataType, unknown, DALIDataType, DALIDataType, DALIDataType