code: def check_npu(use_npu):
      """
      Log error and exit when set use_npu=true in paddlepaddle
      version without paddle-custom-npu installed.
      """
      err = (
          "Config use_npu cannot be set as true while you are "
          "using paddlepaddle version without paddle-custom-npu "
          "installed! \nPlease try: \n"
          "\t1. Install paddle-custom-npu to run model on NPU \n"
          "\t2. Set use_npu as false in config file to run "
          "model on other devices supported."
      )
  
      try:
          if (
              use_npu
              and not "npu"
              in paddle.device.get_all_custom_device_type()
          ):
              logger.error(err)
              sys.exit(1)
      except Exception as e:
          pass
  
file_path: PaddleDetection/ppdet/utils/check.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import sys
  import paddle
  import six
  import paddle.version
  from .logger import setup_logger
label_desc: Use image node_id 2 for calling a global function with example usage: check_npu(use_npu) without return types