code: def _jit_graph_to_onnx_model(
      graph, operator_export_type, opset_version
  ):
      r"""
      This function exports torch::jit::Graph object
      to serialized ONNX ModelProto.
      This function is for testing purpose.
      It only keeps the essential parts for IR graph conversions.
      It also does not interact with actual PyTorch modules nor
      PyTorch tensor inputs.
      """
  
      GLOBALS.export_onnx_opset_version = opset_version
      graph = torch.onnx.utils._optimize_graph(
          graph, operator_export_type, params_dict={}
      )
      proto, _, _, _ = graph._export_onnx(
          {},
          opset_version,
          {},
          False,
          operator_export_type,
          False,
          False,
          {},
          True,
          "",
          {},
      )
      return proto
  
file_path: pytorch/test/onnx/test_pytorch_jit_onnx.py
imports: import onnxruntime
  import pytorch_test_common
  import torch
  from pytorch_test_common import skipIfNoCuda
  from torch.onnx import verification
  from torch.onnx._globals import GLOBALS
  from torch.testing._internal import common_utils
label_desc: Use image node_id 1 for calling a global function with example usage: _jit_graph_to_onnx_model(graph, operator_export_type, opset_version) and returns: proto