code: def test_sparse_dot_determinism():
      def check_dot_determinism(
          lhs_stype,
          rhs_stype,
          lhs_density,
          rhs_density,
          transpose_a,
          transpose_b,
          forward_stype,
      ):
          lhs_row = rnd.randint(50, 100)
          lhs_col = rnd.randint(50, 100)
          if transpose_a:
              if transpose_b:
                  rhs_shape = (rnd.randint(50, 100), lhs_row)
              else:
                  rhs_shape = (lhs_row, rnd.randint(50, 100))
          else:
              if transpose_b:
                  rhs_shape = (rnd.randint(50, 100), lhs_col)
              else:
                  rhs_shape = (lhs_col, rnd.randint(50, 100))
          lhs_shape = (lhs_row, lhs_col)
          lhs = rand_ndarray(lhs_shape, lhs_stype, density=lhs_density)
          rhs = rand_ndarray(rhs_shape, rhs_stype, density=rhs_density)
          res1 = mx.nd.sparse.dot(
              lhs,
              rhs,
              transpose_a=transpose_a,
              transpose_b=transpose_b,
              forward_stype=forward_stype,
          )
          res2 = mx.nd.sparse.dot(
              lhs,
              rhs,
              transpose_a=transpose_a,
              transpose_b=transpose_b,
              forward_stype=forward_stype,
          )
          assert_almost_equal(
              res1.asnumpy(), res2.asnumpy(), rtol=0.0, atol=0.0
          )
  
      check_dot_determinism(
          "csr", "default", 0.1, 1.0, True, False, "row_sparse"
      )
      forward_stype = (
          "csr" if default_device() == mx.cpu() else "default"
      )
      check_dot_determinism(
          "default", "csr", 1.0, 0.1, False, False, forward_stype
      )
      check_dot_determinism(
          "default", "csr", 1.0, 0.1, False, True, forward_stype
      )
      check_dot_determinism(
          "csr", "default", 0.1, 1.0, True, False, "default"
      )
  
imports: from mxnet.test_utils import *
  from mxnet.base import MXNetError
  import pytest
  from common import assertRaises
  import random
  import warnings
label_desc: Use image node_id 20 for calling a global function with example usage: test_sparse_dot_determinism() without return types