code: def get_autocast_dtype(x):
      if x.device.type == "xpu":
          if torch.xpu.is_autocast_xpu_enabled():
              return torch.xpu.get_autocast_xpu_dtype()
          else:
              return None
      elif x.device.type == "cpu":
          if torch.is_autocast_cpu_enabled():
              return torch.get_autocast_cpu_dtype()
          else:
              return None
      else:
          invalidInputError(
              False, f"Device {x.device} is not supported."
          )
  
file_path: BigDL/python/llm/src/bigdl/llm/transformers/utils.py
imports: import os
  from transformers.modeling_utils import _add_variant
  from ..utils.common import invalidInputError
  from typing import Union
  import torch
  from torch import nn
  import logging
label_desc: Use image node_id 6 for calling a global function with example usage: get_autocast_dtype(x) and returns: torch, None, torch, None