code: def test_to_dense_adj():
      edge_index = torch.tensor(
          [
              [0, 0, 1, 2, 3, 4],
              [0, 1, 0, 3, 4, 2],
          ]
      )
      batch = torch.tensor([0, 0, 1, 1, 1])
  
      adj = to_dense_adj(edge_index, batch)
      assert adj.size() == (2, 3, 3)
      assert adj[0].tolist() == [[1, 1, 0], [1, 0, 0], [0, 0, 0]]
      assert adj[1].tolist() == [[0, 1, 0], [0, 0, 1], [1, 0, 0]]
  
      if is_full_test():
          jit = torch.jit.script(to_dense_adj)
          adj = jit(edge_index, batch)
          assert adj.size() == (2, 3, 3)
          assert adj[0].tolist() == [[1, 1, 0], [1, 0, 0], [0, 0, 0]]
          assert adj[1].tolist() == [[0, 1, 0], [0, 0, 1], [1, 0, 0]]
  
      adj = to_dense_adj(edge_index, batch, max_num_nodes=2)
      assert adj.size() == (2, 2, 2)
      assert adj[0].tolist() == [[1, 1], [1, 0]]
      assert adj[1].tolist() == [[0, 1], [0, 0]]
  
      adj = to_dense_adj(edge_index, batch, max_num_nodes=5)
      assert adj.size() == (2, 5, 5)
      assert adj[0][:3, :3].tolist() == [
          [1, 1, 0],
          [1, 0, 0],
          [0, 0, 0],
      ]
      assert adj[1][:3, :3].tolist() == [
          [0, 1, 0],
          [0, 0, 1],
          [1, 0, 0],
      ]
  
      edge_attr = torch.tensor([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
      adj = to_dense_adj(edge_index, batch, edge_attr)
      assert adj.size() == (2, 3, 3)
      assert adj[0].tolist() == [[1, 2, 0], [3, 0, 0], [0, 0, 0]]
      assert adj[1].tolist() == [[0, 4, 0], [0, 0, 5], [6, 0, 0]]
  
      adj = to_dense_adj(edge_index, batch, edge_attr, max_num_nodes=5)
      assert adj.size() == (2, 5, 5)
      assert adj[0][:3, :3].tolist() == [
          [1, 2, 0],
          [3, 0, 0],
          [0, 0, 0],
      ]
      assert adj[1][:3, :3].tolist() == [
          [0, 4, 0],
          [0, 0, 5],
          [6, 0, 0],
      ]
  
      edge_attr = edge_attr.view(-1, 1)
      adj = to_dense_adj(edge_index, batch, edge_attr)
      assert adj.size() == (2, 3, 3, 1)
  
      edge_attr = edge_attr.view(-1, 1)
      adj = to_dense_adj(edge_index, batch, edge_attr, max_num_nodes=5)
      assert adj.size() == (2, 5, 5, 1)
  
      adj = to_dense_adj(edge_index)
      assert adj.size() == (1, 5, 5)
      assert (
          adj[0].nonzero(as_tuple=False).t().tolist()
          == edge_index.tolist()
      )
  
      adj = to_dense_adj(edge_index, max_num_nodes=10)
      assert adj.size() == (1, 10, 10)
      assert (
          adj[0].nonzero(as_tuple=False).t().tolist()
          == edge_index.tolist()
      )
  
      adj = to_dense_adj(edge_index, batch, batch_size=4)
      assert adj.size() == (4, 3, 3)
  
imports: import torch
  from torch_geometric.testing import is_full_test
  from torch_geometric.utils import to_dense_adj
label_desc: Use image node_id 1 for calling a global function with example usage: test_to_dense_adj() without return types