code: def test_gluon_trainer_sparse_step():
      def check_trainer_sparse_step():
          ctx = mx.cpu(0)
          shape = (2, 10)
          all_rows = mx.nd.arange(0, shape[0], ctx=ctx)
          x = mx.gluon.Parameter(
              "x",
              shape=shape,
              stype="row_sparse",
              grad_stype="row_sparse",
          )
          x.initialize(ctx=ctx, init="ones")
          trainer = mx.gluon.Trainer(
              [x], "sgd", {"learning_rate": 1.0}, kvstore=kv
          )
          with mx.autograd.record():
              w = x.row_sparse_data(all_rows)
              y = (my_rank + 1) * w
              y.backward()
          trainer.step(1)
          expected = 1 - (1 + nworker) * nworker / 2
          assert_almost_equal(
              x.row_sparse_data(all_rows).asnumpy(),
              np.full(shape, expected),
          )
  
      check_trainer_sparse_step()
      print(
          "worker "
          + str(my_rank)
          + " passed test_gluon_trainer_sparse_step"
      )
  
file_path: mxnet/tests/nightly/dist_sync_kvstore.py
imports: import sys
  import argparse
  import mxnet
  import numpy
  import numpy.random
  from mxnet.test_utils import assert_almost_equal, assert_exception
  from test_kvstore import compute_expected_quantization, compute_1bit, compute_2bit
label_desc: Use image node_id 12 for calling a global function with example usage: test_gluon_trainer_sparse_step() without return types