class_docstr: Autocast context manager for Pytorch 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","Model","Inference",".","This","context","manager","is","used","for","providing","no","grad","and","autocast","context",",","which","is","used","for","bf16","model","."]
code: def __enter__(self):
      super().__enter__()
      if self.accelerator == "jit" and self.enable_onednn is True:
          if compare_version("torch", operator.lt, "1.14"):
              # onednn fusion for bf16 only work for torch version > 1.13
              if compare_version("torch", operator.ge, "1.12.0"):
                  # onednn fusion be added to torch from version 1.12
                  torch.jit.enable_onednn_fusion(False)
      if self.accelerator == "jit":
          # Disable AMP for JIT
          torch._C._jit_set_autocast_mode(False)
      self.autocast.__enter__()
  
imports: import torch
  import operator
  from bigdl.nano.utils.common import compare_version
label_desc: Use image node_id 2 for calling the AutocastContextManager obj's underlying member method code with example usage: obj.__enter__() without return types