code: def test_to(dtype, device, is_undirected):
      kwargs = dict(dtype=dtype, is_undirected=is_undirected)
      adj = EdgeIndex(
          [[0, 1, 1, 2], [1, 0, 2, 1]], sort_order="row", **kwargs
      )
      adj.fill_cache_()
  
      adj = adj.to(device)
      assert isinstance(adj, EdgeIndex)
      assert adj.device == device
      assert adj._indptr.device == device
      assert adj._T_perm.device == device
  
      out = adj.cpu()
      assert isinstance(out, EdgeIndex)
      assert out.device == torch.device("cpu")
  
      out = adj.to(torch.int)
      assert out.dtype == torch.int
      if torch_geometric.typing.WITH_PT20:
          assert isinstance(out, EdgeIndex)
          assert out._indptr.dtype == torch.int
          assert out._T_perm.dtype == torch.int
      else:
          assert not isinstance(out, EdgeIndex)
  
      out = adj.to(torch.float)
      assert not isinstance(out, EdgeIndex)
      assert out.dtype == torch.float
  
      out = adj.long()
      assert isinstance(out, EdgeIndex)
      assert out.dtype == torch.int64
  
      out = adj.int()
      assert out.dtype == torch.int
      if torch_geometric.typing.WITH_PT20:
          assert isinstance(out, EdgeIndex)
      else:
          assert not isinstance(out, 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 9 for calling a global function with example usage: test_to(dtype, device, is_undirected) without return types