code: def test_sparse_nd_binary_scalar_op():
      N = 3
  
      def check(fn, stype, out_stype=None):
          for _ in range(N):
              ndim = 2
              shape = np.random.randint(1, 6, size=(ndim,))
              npy = np.random.normal(0, 1, size=shape)
              nd = mx.nd.array(npy).tostype(stype)
              if out_stype is not None:
                  assert nd.stype == out_stype
              assert_allclose(
                  fn(npy), fn(nd).asnumpy(), rtol=1e-4, atol=1e-4
              )
  
      stypes = ["row_sparse", "csr"]
      for stype in stypes:
          check(lambda x: 1 + x, stype)
          check(lambda x: 1 - x, stype)
          check(lambda x: 1 * x, stype)
          check(lambda x: 1 / x, stype)
          check(lambda x: 2**x, stype)
          check(lambda x: 1 > x, stype)
          check(lambda x: 0.5 > x, stype)
          check(lambda x: 0.5 < x, stype)
          check(lambda x: 0.5 >= x, stype)
          check(lambda x: 0.5 <= x, stype)
          check(lambda x: 0.5 == x, stype)
          check(lambda x: x / 2, stype, out_stype=stype)
          check(lambda x: x + 0, stype, out_stype=stype)
          check(lambda x: x - 0, stype, out_stype=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 15 for calling a global function with example usage: test_sparse_nd_binary_scalar_op() without return types