code: def test_sparse_matrix_transpose(dense_dim, row, col, extra_shape):
      mat_shape = (
          max(row) + 1 + extra_shape[0],
          max(col) + 1 + extra_shape[1],
      )
      val_shape = (len(row),)
      if dense_dim is not None:
          val_shape += (dense_dim,)
      ctx = F.ctx()
      val = torch.randn(val_shape).to(ctx)
      row = torch.tensor(row).to(ctx)
      col = torch.tensor(col).to(ctx)
      mat = from_coo(row, col, val, mat_shape).transpose()
      mat_row, mat_col = mat.coo()
      mat_val = mat.val
  
      assert mat.shape == mat_shape[::-1]
      assert torch.allclose(mat_val, val)
      assert torch.allclose(mat_row, col)
      assert torch.allclose(mat_col, row)
  
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 24 for calling a global function with example usage: test_sparse_matrix_transpose(dense_dim, row, col, extra_shape) without return types