code: def test_cat(dtype, device, is_undirected):
      args = dict(
          dtype=dtype, device=device, is_undirected=is_undirected
      )
      adj1 = EdgeIndex(
          [[0, 1, 1, 2], [1, 0, 2, 1]], sparse_size=(3, 3), **args
      )
      adj2 = EdgeIndex(
          [[1, 2, 2, 3], [2, 1, 3, 2]], sparse_size=(4, 4), **args
      )
      adj3 = EdgeIndex(
          [[1, 2, 2, 3], [2, 1, 3, 2]], dtype=dtype, device=device
      )
  
      out = torch.cat([adj1], dim=1)
      assert id(out) == id(adj1)
  
      out = torch.cat([adj1, adj2], dim=1)
      assert out.size() == (2, 8)
      assert isinstance(out, EdgeIndex)
      assert out.sparse_size() == (4, 4)
      assert not out.is_sorted
      assert out.is_undirected == is_undirected
  
      assert out._cat_metadata.nnz == [4, 4]
      assert out._cat_metadata.sparse_size == [(3, 3), (4, 4)]
      assert out._cat_metadata.sort_order == [None, None]
      assert out._cat_metadata.is_undirected == [
          is_undirected,
          is_undirected,
      ]
  
      out = torch.cat([adj1, adj2, adj3], dim=1)
      assert out.size() == (2, 12)
      assert isinstance(out, EdgeIndex)
      assert out.sparse_size() == (None, None)
      assert not out.is_sorted
      assert not out.is_undirected
  
      out = torch.cat([adj1, adj2], dim=0)
      assert out.size() == (4, 4)
      assert not isinstance(out, EdgeIndex)
  
      inplace = torch.empty(2, 8, dtype=dtype, device=device)
      out = torch.cat([adj1, adj2], dim=1, out=inplace)
      assert out.data_ptr() == inplace.data_ptr()
      assert isinstance(out, EdgeIndex)
      assert not isinstance(inplace, EdgeIndex)
  
imports: import os.path
  import warnings
  from typing import List, Optional
  import pytest
  import torch
  from torch import Tensor, tensor
  import torch_geometric
  from torch_geometric import EdgeIndex
  from torch_geometric.edge_index import SUPPORTED_DTYPES, ReduceType, SortReturnType, _scatter_spmm, _torch_sparse_spmm, _TorchSPMM, set_tuple_item
  from torch_geometric.profile import benchmark
  from torch_geometric.testing import onlyCUDA, onlyLinux, withCUDA, withoutExtensions, withPackage
  from torch_geometric.typing import SparseTensor
  from torch_geometric.utils import scatter
label_desc: Use image node_id 14 for calling a global function with example usage: test_cat(dtype, device, is_undirected) without return types