code: def test_sparse_dot_grad():
      def check_sparse_dot_grad(rhs):
          lhs = rand_ndarray((2, 8), "csr")
          with mx.autograd.record():
              y = mx.nd.dot(lhs, rhs)
          y.backward()
          grad = rhs.grad
          grad_np = np.dot(
              lhs.asnumpy().T, np.ones((lhs.shape[0], rhs.shape[1]))
          )
          assert grad.stype == "row_sparse"
          assert_almost_equal(grad.asnumpy(), grad_np)
  
      # check grad with row_sparse weight
      shape = (8, 3)
      rsp = mx.nd.ones(shape).tostype("row_sparse")
      rsp.attach_grad()
      check_sparse_dot_grad(rsp)
  
      # check grad with dense weight
      dns = mx.nd.ones(shape)
      dns.attach_grad(stype="row_sparse")
      check_sparse_dot_grad(dns)
  
imports: import functools
  import mxnet.ndarray
  from mxnet.ndarray import zeros_like
  from mxnet.autograd import *
  from mxnet.test_utils import *
  from common import xfail_when_nonstandard_decimal_separator
  from mxnet.test_utils import environment
  import pytest
label_desc: Use image node_id 20 for calling a global function with example usage: test_sparse_dot_grad() without return types