code: def test_cat(layout, dim, device):
      edge_index = torch.tensor(
          [[0, 1, 1, 2], [1, 0, 2, 1]], device=device
      )
      if torch_geometric.typing.WITH_PT20:
          edge_weight = torch.rand(4, 2, device=device)
      else:
          edge_weight = torch.rand(4, device=device)
  
      adj = to_torch_sparse_tensor(
          edge_index, edge_weight, layout=layout
      )
  
      out = cat([adj, adj], dim=dim)
      edge_index, edge_weight = to_edge_index(out.to_sparse_csr())
  
      if dim == 0:
          if torch_geometric.typing.WITH_PT20:
              assert out.size() == (6, 3, 2)
          else:
              assert out.size() == (6, 3)
          assert edge_index[0].tolist() == [0, 1, 1, 2, 3, 4, 4, 5]
          assert edge_index[1].tolist() == [1, 0, 2, 1, 1, 0, 2, 1]
      elif dim == 1:
          if torch_geometric.typing.WITH_PT20:
              assert out.size() == (3, 6, 2)
          else:
              assert out.size() == (3, 6)
          assert edge_index[0].tolist() == [0, 0, 1, 1, 1, 1, 2, 2]
          assert edge_index[1].tolist() == [1, 4, 0, 2, 3, 5, 1, 4]
      else:
          if torch_geometric.typing.WITH_PT20:
              assert out.size() == (6, 6, 2)
          else:
              assert out.size() == (6, 6)
          assert edge_index[0].tolist() == [0, 1, 1, 2, 3, 4, 4, 5]
          assert edge_index[1].tolist() == [1, 0, 2, 1, 4, 3, 5, 4]
  
file_path: pytorch_geometric/test/utils/test_sparse.py
imports: import os.path
  import pytest
  import torch
  import torch_geometric.typing
  from torch_geometric.profile import benchmark
  from torch_geometric.testing import is_full_test, withCUDA, withPackage
  from torch_geometric.typing import SparseTensor
  from torch_geometric.utils import dense_to_sparse, is_sparse, is_torch_sparse_tensor, to_edge_index, to_torch_coo_tensor, to_torch_csc_tensor, to_torch_csr_tensor, to_torch_sparse_tensor
  from torch_geometric.utils.sparse import cat
label_desc: Use image node_id 10 for calling a global function with example usage: test_cat(layout, dim, device) without return types