code: def test_row_sparse_pull():
      kv = init_kv_with_str("row_sparse")
      kv.init("e", mx.nd.ones(shape).tostype("row_sparse"))
  
      def check_row_sparse_pull(kv, count):
          num_rows = shape[0]
          vals = []
          row_ids = []
          all_row_ids = np.arange(num_rows)
          for _ in range(count):
              vals.append(mx.nd.zeros(shape).tostype("row_sparse"))
              row_id = np.random.randint(num_rows, size=num_rows)
              row_ids.append(
                  mx.nd.array(row_id).reshape((2, num_rows // 2))
              )
          row_ids_to_pull = row_ids[0] if len(row_ids) == 1 else row_ids
          vals_to_pull = vals[0] if len(vals) == 1 else vals
  
          kv.row_sparse_pull(
              "e", out=vals_to_pull, row_ids=row_ids_to_pull
          )
          for val, row_id in zip(vals, row_ids):
              retained = val.asnumpy()
              excluded_row_ids = np.setdiff1d(
                  all_row_ids, row_id.asnumpy()
              )
              for row in range(num_rows):
                  expected_val = np.zeros_like(retained[row])
                  expected_val += 0 if row in excluded_row_ids else 1
                  assert_almost_equal(retained[row], expected_val)
  
      check_row_sparse_pull(kv, 1)
      check_row_sparse_pull(kv, 4)
  
imports: import mxnet
  import numpy
  import unittest
  from mxnet.test_utils import rand_ndarray, assert_almost_equal
  from common import assertRaises
  from mxnet.base import py_str, MXNetError
  import pytest
label_desc: Use image node_id 5 for calling a global function with example usage: test_row_sparse_pull() without return types