code: def test_sparse_nd_binary():
      N = 3
  
      def check_binary(fn, stype):
          for _ in range(N):
              ndim = 2
              oshape = np.random.randint(1, 6, size=(ndim,))
              bdim = 2
              lshape = list(oshape)
              # one for broadcast op, another for elemwise op
              rshape = list(oshape[ndim - bdim :])
              for i in range(bdim):
                  sep = np.random.uniform(0, 1)
                  if sep < 0.33:
                      lshape[ndim - i - 1] = 1
                  elif sep < 0.66:
                      rshape[bdim - i - 1] = 1
              lhs = np.random.uniform(0, 1, size=lshape)
              rhs = np.random.uniform(0, 1, size=rshape)
              lhs_nd = mx.nd.array(lhs).tostype(stype)
              rhs_nd = mx.nd.array(rhs).tostype(stype)
              assert_allclose(
                  fn(lhs, rhs),
                  fn(lhs_nd, rhs_nd).asnumpy(),
                  rtol=1e-4,
                  atol=1e-4,
              )
              assert_allclose(
                  fn(lhs, lhs),
                  fn(lhs_nd, lhs_nd).asnumpy(),
                  rtol=1e-4,
                  atol=1e-4,
              )
  
      stypes = ["row_sparse", "csr"]
      for stype in stypes:
          check_binary(lambda x, y: x + y, stype)
          check_binary(lambda x, y: x - y, stype)
          check_binary(lambda x, y: x * y, stype)
          check_binary(lambda x, y: x / y, stype)
          check_binary(lambda x, y: x**y, stype)
          check_binary(lambda x, y: x > y, stype)
          check_binary(lambda x, y: x < y, stype)
          check_binary(lambda x, y: x >= y, stype)
          check_binary(lambda x, y: x <= y, stype)
          check_binary(lambda x, y: x == y, stype)
  
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 14 for calling a global function with example usage: test_sparse_nd_binary() without return types