code: def test_torch_sparse_coo_conversion(row, col, nz_dim, shape):
      dev = F.ctx()
      row = torch.tensor(row).to(dev)
      col = torch.tensor(col).to(dev)
      indices = torch.stack([row, col])
      torch_sparse_shape = shape
      val_shape = (row.shape[0],)
      if nz_dim is not None:
          torch_sparse_shape += (nz_dim,)
          val_shape += (nz_dim,)
      val = torch.randn(val_shape).to(dev)
      torch_sparse_coo = torch.sparse_coo_tensor(
          indices, val, torch_sparse_shape
      )
      spmat = from_torch_sparse(torch_sparse_coo)
  
      def _assert_spmat_equal_to_torch_sparse_coo(
          spmat, torch_sparse_coo
      ):
          assert torch_sparse_coo.layout == torch.sparse_coo
          # Use .data_ptr() to check whether indices and values are on the same
          # memory address
          assert (
              spmat.indices().data_ptr()
              == torch_sparse_coo._indices().data_ptr()
          )
          assert (
              spmat.val.data_ptr()
              == torch_sparse_coo._values().data_ptr()
          )
          assert spmat.shape == torch_sparse_coo.shape[:2]
  
      _assert_spmat_equal_to_torch_sparse_coo(spmat, torch_sparse_coo)
      torch_sparse_coo = to_torch_sparse_coo(spmat)
      _assert_spmat_equal_to_torch_sparse_coo(spmat, torch_sparse_coo)
  
imports: import unittest
  import warnings
  import backend
  import pytest
  import torch
  from dgl.sparse import diag, from_coo, from_csc, from_csr, from_torch_sparse, identity, to_torch_sparse_coo, to_torch_sparse_csc, to_torch_sparse_csr, val_like
  from .utils import rand_coo, rand_csc, rand_csr, rand_diag, sparse_matrix_to_dense
label_desc: Use image node_id 25 for calling a global function with example usage: test_torch_sparse_coo_conversion(row, col, nz_dim, shape) without return types