code: def test_onnx(tmp_path):
      import onnx
      import onnxruntime as ort
  
      warnings.filterwarnings(
          "ignore", ".*tensor to a Python boolean.*"
      )
      warnings.filterwarnings(
          "ignore", ".*shape inference of prim::Constant.*"
      )
  
      class MyModel(torch.nn.Module):
          def __init__(self):
              super().__init__()
              self.conv1 = SAGEConv(8, 16)
              self.conv2 = SAGEConv(16, 16)
  
          def forward(self, x, edge_index):
              x = self.conv1(x, edge_index).relu()
              x = self.conv2(x, edge_index)
              return x
  
      model = MyModel()
      x = torch.randn(3, 8)
      edge_index = torch.tensor([[0, 1, 2], [1, 0, 2]])
      expected = model(x, edge_index)
      assert expected.size() == (3, 16)
  
      path = osp.join(tmp_path, "model.onnx")
      torch.onnx.export(
          model,
          (x, edge_index),
          path,
          input_names=("x", "edge_index"),
          opset_version=16,
      )
  
      model = onnx.load(path)
      onnx.checker.check_model(model)
  
      providers = ["CPUExecutionProvider"]
      ort_session = ort.InferenceSession(path, providers=providers)
  
      out = ort_session.run(
          None, {"x": x.numpy(), "edge_index": edge_index.numpy()}
      )[0]
      out = torch.from_numpy(out)
      assert torch.allclose(out, expected, atol=1e-6)
  
imports: import os
  import os.path
  import random
  import sys
  import warnings
  import pytest
  import torch
  import torch.nn.functional
  import torch_geometric.typing
  from torch_geometric.data import Data
  from torch_geometric.loader import NeighborLoader
  from torch_geometric.nn import SAGEConv
  from torch_geometric.nn.models import GAT, GCN, GIN, PNA, EdgeCNN, GraphSAGE
  from torch_geometric.profile import benchmark
  from torch_geometric.testing import onlyFullTest, onlyLinux, onlyNeighborSampler, onlyOnline, withCUDA, withPackage
label_desc: Use image node_id 13 for calling a global function with example usage: test_onnx(tmp_path) and returns: x