code: def Constant(
      value, dtype=None, shape=None, layout=None, device=None, **kwargs
  ):
      """Wraps a constant value which can then be used in
      :meth:`nvidia.dali.Pipeline.define_graph` pipeline definition step.
  
      If the `value` argument is a scalar and neither `shape`, `layout` nor
      `device` is provided, the function will return a :class:`ScalarConstant`
      wrapper object, which receives special, optimized treatment when used in
      :ref:`mathematical expressions`.
  
      Otherwise, the function creates a `dali.ops.Constant` node, which produces
      a batch of constant tensors.
  
      Args
      ----
      value: `bool`, `int`, `float`, a `list` or `tuple` thereof or a `numpy.ndarray`
          The constant value to wrap. If it is a scalar, it can be used as scalar
          value in mathematical expressions. Otherwise, it will produce a constant
          tensor node (optionally reshaped according to `shape` argument).
          If this argument is is a numpy array, a PyTorch tensor or an MXNet array,
          the values of `shape` and `dtype` will default to `value.shape` and `value.dtype`,
          respectively.
      dtype: DALIDataType, optional
          Target type of the constant.
      shape: list or tuple of int, optional
          Requested shape of the output. If `value` is a scalar, it is broadcast
          as to fill the requested shape. Otherwise, the number of elements in
          `value` must match the volume of the shape.
      layout: string, optional
          A string describing the layout of the constant tensor, e.g. "HWC"
      device: string, optional, "cpu" or "gpu"
          The device to place the constant tensor in. If specified, it forces
          the value to become a constant tensor node on given device,
          regardless of `value` type or `shape`.
      **kwargs: additional keyword arguments
          If present, it forces the constant to become a Constant tensor node
          and the arguments are passed to the `dali.ops.Constant` operator
      """
  
      if (
          device is not None
          or (
              _is_compatible_array_type(value)
              and not _is_true_scalar(value)
          )
          or isinstance(value, (list, tuple))
          or not _is_scalar_shape(shape)
          or kwargs
          or layout is not None
      ):
          return ConstantNode(
              device, value, dtype, shape, layout, **kwargs
          )
      else:
          return ScalarConstant(value, dtype)
  
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 22 for calling a global function with example usage: Constant(value, dtype, shape, layout, device) and returns: ConstantNode, ScalarConstant