code: def test_caching(dtype, device):
      row, col = tensor(
          [[0, 0, 1, 1], [0, 1, 0, 1]], torch.long, device
      )
      storage = SparseStorage(row=row, col=col)
  
      assert storage._row.tolist() == row.tolist()
      assert storage._col.tolist() == col.tolist()
      assert storage._value is None
  
      assert storage._rowcount is None
      assert storage._rowptr is None
      assert storage._colcount is None
      assert storage._colptr is None
      assert storage._csr2csc is None
      assert storage.num_cached_keys() == 0
  
      storage.fill_cache_()
      assert storage._rowcount.tolist() == [2, 2]
      assert storage._rowptr.tolist() == [0, 2, 4]
      assert storage._colcount.tolist() == [2, 2]
      assert storage._colptr.tolist() == [0, 2, 4]
      assert storage._csr2csc.tolist() == [0, 2, 1, 3]
      assert storage._csc2csr.tolist() == [0, 2, 1, 3]
      assert storage.num_cached_keys() == 5
  
      storage = SparseStorage(
          row=row,
          rowptr=storage._rowptr,
          col=col,
          value=storage._value,
          sparse_sizes=storage._sparse_sizes,
          rowcount=storage._rowcount,
          colptr=storage._colptr,
          colcount=storage._colcount,
          csr2csc=storage._csr2csc,
          csc2csr=storage._csc2csr,
      )
  
      assert storage._rowcount.tolist() == [2, 2]
      assert storage._rowptr.tolist() == [0, 2, 4]
      assert storage._colcount.tolist() == [2, 2]
      assert storage._colptr.tolist() == [0, 2, 4]
      assert storage._csr2csc.tolist() == [0, 2, 1, 3]
      assert storage._csc2csr.tolist() == [0, 2, 1, 3]
      assert storage.num_cached_keys() == 5
  
      storage.clear_cache_()
      assert storage._rowcount is None
      assert storage._rowptr is not None
      assert storage._colcount is None
      assert storage._colptr is None
      assert storage._csr2csc is None
      assert storage.num_cached_keys() == 0
  
file_path: pytorch_sparse/test/test_storage.py
imports: from itertools import product
  import pytest
  import torch
  from torch_sparse.storage import SparseStorage
  from torch_sparse.testing import devices, dtypes, tensor
label_desc: Use image node_id 3 for calling a global function with example usage: test_caching(dtype, device) without return types