code: def test_torch_profile(capfd, get_dataset, device):
      dataset = get_dataset(name="Cora")
      data = dataset[0].to(device)
      model = GraphSAGE(
          dataset.num_features,
          hidden_channels=64,
          num_layers=3,
          out_channels=dataset.num_classes,
      ).to(device)
  
      with torch_profile():
          model(data.x, data.edge_index)
  
      out, _ = capfd.readouterr()
      assert "Self CPU time total" in out
      if data.x.is_cuda:
          assert "Self CUDA time total" in out
  
      rename_profile_file("test_profile")
      assert osp.exists("profile-test_profile.json")
      os.remove("profile-test_profile.json")
  
file_path: pytorch_geometric/test/profile/test_profile.py
imports: import os
  import os.path
  import warnings
  import pytest
  import torch
  import torch.nn.functional
  from torch_geometric.nn import GraphSAGE
  from torch_geometric.profile import get_stats_summary, profileit, rename_profile_file, timeit
  from torch_geometric.profile.profile import torch_profile, xpu_profile
  from torch_geometric.testing import onlyCUDA, onlyLinux, onlyOnline, onlyXPU, withCUDA, withPackage
label_desc: Use image node_id 4 for calling a global function with example usage: test_torch_profile(capfd, get_dataset, device) without return types