code: def test_to_dense(dtype, device, value_dtype):
      kwargs = dict(dtype=dtype, device=device)
      adj = EdgeIndex([[1, 0, 2, 1], [0, 1, 1, 2]], **kwargs)
  
      out = adj.to_dense(dtype=value_dtype)
      assert isinstance(out, Tensor)
      assert out.size() == (3, 3)
      expected = [[0.0, 1.0, 0.0], [1.0, 0.0, 1.0], [0.0, 1.0, 0.0]]
      assert out.equal(
          tensor(expected, dtype=value_dtype, device=device)
      )
  
      value = torch.arange(
          1, 5, dtype=value_dtype or torch.float, device=device
      )
      out = adj.to_dense(value)
      assert isinstance(out, Tensor)
      assert out.size() == (3, 3)
      expected = [[0.0, 2.0, 0.0], [1.0, 0.0, 4.0], [0.0, 3.0, 0.0]]
      assert out.equal(
          tensor(expected, dtype=value_dtype, device=device)
      )
  
      value = torch.arange(
          1, 5, dtype=value_dtype or torch.float, device=device
      )
      out = adj.to_dense(value.view(-1, 1))
      assert isinstance(out, Tensor)
      assert out.size() == (3, 3, 1)
      expected = [
          [[0.0], [2.0], [0.0]],
          [[1.0], [0.0], [4.0]],
          [[0.0], [3.0], [0.0]],
      ]
      assert out.equal(
          tensor(expected, dtype=value_dtype, device=device)
      )
  
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 19 for calling a global function with example usage: test_to_dense(dtype, device, value_dtype) without return types