code: def _torchscript_patch(cls) -> None:
      # HACK: for torch script
      # https://github.com/pytorch/pytorch/pull/45261
      # https://github.com/pytorch/pytorch/issues/54688
      # I'm not sure whether there will be potential issues
      import torch
  
      if hasattr(cls, "_get_nni_attr"):  # could not exist on non-linux
          cls._get_nni_attr = torch.jit.ignore(cls._get_nni_attr)
      if hasattr(cls, "trace_symbol"):
          # these must all exist or all non-exist
          try:
              cls.trace_symbol = torch.jit.unused(cls.trace_symbol)
              cls.trace_args = torch.jit.unused(cls.trace_args)
              cls.trace_kwargs = torch.jit.unused(cls.trace_kwargs)
              cls.trace_copy = torch.jit.ignore(cls.trace_copy)
          except AttributeError as e:
              if "property" in str(e):
                  raise RuntimeError(
                      "Trace on PyTorch module failed. Your PyTorch version might be outdated. "
                      "Please try to upgrade PyTorch."
                  )
              raise
  
file_path: nni/nni/nas/utils/_legacy.py
imports: import inspect
  import os
  import warnings
  from typing import Any, TypeVar, Type
  from nni.common.serializer import is_traceable, is_wrapped_with_trace, trace
label_desc: Use image node_id 8 for calling a global function with example usage: _torchscript_patch(cls) without return types