code: def test_fill_cache_(dtype, device, is_undirected):
      kwargs = dict(
          dtype=dtype, device=device, is_undirected=is_undirected
      )
      adj = EdgeIndex(
          [[0, 1, 1, 2], [1, 0, 2, 1]], sort_order="row", **kwargs
      )
      adj.validate().fill_cache_()
      assert adj.sparse_size() == (3, 3)
      assert adj._indptr.dtype == dtype
      assert adj._indptr.equal(tensor([0, 1, 3, 4], device=device))
      assert adj._T_perm.dtype == torch.int64
      assert adj._T_perm.equal(
          tensor([1, 0, 3, 2], device=device)
      ) or adj._T_perm.equal(tensor([1, 3, 0, 2], device=device))
      assert adj._T_index[0].dtype == dtype
      assert adj._T_index[0].equal(
          tensor([1, 0, 2, 1], device=device)
      ) or adj._T_index[0].equal(tensor([1, 2, 0, 1], device=device))
      assert adj._T_index[1].dtype == dtype
      assert adj._T_index[1].equal(tensor([0, 1, 1, 2], device=device))
      if is_undirected:
          assert adj._T_indptr is None
      else:
          assert adj._T_indptr.dtype == dtype
          assert adj._T_indptr.equal(
              tensor([0, 1, 3, 4], device=device)
          )
  
      adj = EdgeIndex(
          [[1, 0, 2, 1], [0, 1, 1, 2]], sort_order="col", **kwargs
      )
      adj.validate().fill_cache_()
      assert adj.sparse_size() == (3, 3)
      assert adj._indptr.dtype == dtype
      assert adj._indptr.equal(tensor([0, 1, 3, 4], device=device))
      assert adj._T_perm.equal(
          tensor([1, 0, 3, 2], device=device)
      ) or adj._T_perm.equal(tensor([1, 3, 0, 2], device=device))
      assert adj._T_index[0].dtype == dtype
      assert adj._T_index[0].equal(tensor([0, 1, 1, 2], device=device))
      assert adj._T_index[1].dtype == dtype
      assert adj._T_index[1].equal(
          tensor([1, 0, 2, 1], device=device)
      ) or adj._T_index[1].equal(tensor([1, 2, 0, 1], device=device))
      if is_undirected:
          assert adj._T_indptr is None
      else:
          assert adj._T_indptr.dtype == dtype
          assert adj._T_indptr.equal(
              tensor([0, 1, 3, 4], 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 7 for calling a global function with example usage: test_fill_cache_(dtype, device, is_undirected) without return types