code: def test_sparse_nd_elemwise_add():
      def check_sparse_nd_elemwise_binary(shapes, stypes, f, g):
          # generate inputs
          nds = []
          for i, stype in enumerate(stypes):
              if stype == "row_sparse":
                  nd, _ = rand_sparse_ndarray(shapes[i], stype)
              elif stype == "default":
                  nd = mx.nd.array(
                      random_arrays(shapes[i]), dtype=np.float32
                  )
              else:
                  assert False
              nds.append(nd)
          # check result
          test = f(nds[0], nds[1])
          assert_almost_equal(
              test.asnumpy(), g(nds[0].asnumpy(), nds[1].asnumpy())
          )
  
      num_repeats = 3
      g = lambda x, y: x + y
      op = mx.nd.elemwise_add
      for _ in range(num_repeats):
          shape = [rand_shape_2d()] * 2
          check_sparse_nd_elemwise_binary(shape, ["default"] * 2, op, g)
          check_sparse_nd_elemwise_binary(
              shape, ["row_sparse", "row_sparse"], op, g
          )
  
imports: import pickle
  from mxnet.ndarray import NDArray
  import mxnet
  from mxnet.test_utils import *
  from common import random_seed
  from mxnet.base import mx_real_t
  from numpy.testing import assert_allclose
  import numpy.random
  import numpy
  import scipy.sparse
  from common import assertRaises, xfail_when_nonstandard_decimal_separator
  from mxnet.ndarray.sparse import RowSparseNDArray, CSRNDArray
  import pytest
label_desc: Use image node_id 2 for calling a global function with example usage: test_sparse_nd_elemwise_add() without return types