code: def test_sage_conv(project, aggr):
      x = torch.randn(4, 8)
      edge_index = torch.tensor([[0, 1, 2, 3], [0, 0, 1, 1]])
  
      conv = SAGEConv(8, 32, project=project, aggr=aggr)
      assert str(conv) == f"SAGEConv(8, 32, aggr={aggr})"
  
      out = assert_module(conv, x, edge_index, expected_size=(4, 32))
  
      if is_full_test():
          jit = torch.jit.script(conv)
          assert torch.allclose(jit(x, edge_index), out, atol=1e-6)
          assert torch.allclose(
              jit(x, edge_index, size=(4, 4)), out, atol=1e-6
          )
  
          if torch_geometric.typing.WITH_TORCH_SPARSE:
              adj = SparseTensor.from_edge_index(
                  edge_index, sparse_sizes=(4, 4)
              )
              assert torch.allclose(jit(x, adj.t()), out, atol=1e-6)
  
      # Test bipartite message passing:
      x1 = torch.randn(4, 8)
      x2 = torch.randn(2, 16)
  
      conv = SAGEConv((8, 16), 32, project=project, aggr=aggr)
      assert str(conv) == f"SAGEConv((8, 16), 32, aggr={aggr})"
  
      out1 = assert_module(
          conv, (x1, x2), edge_index, expected_size=(2, 32)
      )
      out2 = assert_module(
          conv,
          (x1, None),
          edge_index,
          size=(4, 2),
          expected_size=(2, 32),
      )
  
      if is_full_test():
          jit = torch.jit.script(conv)
          assert torch.allclose(
              jit((x1, x2), edge_index), out1, atol=1e-6
          )
          assert torch.allclose(
              jit((x1, x2), edge_index, size=(4, 2)), out1
          )
          assert torch.allclose(
              jit((x1, None), edge_index, size=(4, 2)), out2
          )
  
          if torch_geometric.typing.WITH_TORCH_SPARSE:
              adj = SparseTensor.from_edge_index(
                  edge_index, sparse_sizes=(4, 2)
              )
              assert torch.allclose(
                  jit((x1, x2), adj.t()), out1, atol=1e-6
              )
              assert torch.allclose(
                  jit((x1, None), adj.t()), out2, atol=1e-6
              )
  
file_path: pytorch_geometric/test/nn/conv/test_sage_conv.py
imports: import pytest
  import torch
  import torch_geometric.typing
  from torch_geometric.nn import MLPAggregation, SAGEConv
  from torch_geometric.testing import assert_module, is_full_test, onlyLinux, withCUDA, withPackage
  from torch_geometric.typing import SparseTensor
label_desc: Use image node_id 1 for calling a global function with example usage: test_sage_conv(project, aggr) without return types