class_docstr: Autocast context manager for Pytorch XPU Model Inference.
  
  This context manager is used for providing no grad and autocast context,
  which is used for bf16 model.
class_docstr_tok: ["Autocast","context","manager","for","Pytorch","XPU","Model","Inference",".","This","context","manager","is","used","for","providing","no","grad","and","autocast","context",",","which","is","used","for","bf16","model","."]
code: def __init__(
      self, thread_num=None, accelerator=None, enable_onednn=True
  ):
      super().__init__(
          thread_num=thread_num,
          accelerator=accelerator,
          enable_onednn=enable_onednn,
      )
      self.autocast = torch.xpu.amp.autocast(
          enabled=True, dtype=torch.float16
      )
  
imports: import torch
  import operator
  from bigdl.nano.utils.common import compare_version
label_desc: Use image node_id 1 to create a new XPUAutocastContextManager object from inherited base classes: AutocastContextManager with example: obj = XPUAutocastContextManager(thread_num, accelerator, enable_onednn)