code: def test_broadcast():
      def check_broadcast(kv, cur_keys, cur_shape, device=False):
          print(
              "check_broadcast: {}, {}, {}, {}".format(
                  kv, cur_keys, cur_shape, device
              )
          )
          ctx = get_current_device(device=device)
          val = [mx.nd.zeros(cur_shape, ctx) for i in cur_keys]
          for i in range(len(cur_keys)):
              expected = i
              tmpNDarray = [mx.nd.ones(cur_shape, ctx) * i]
              kv.broadcast(cur_keys[i], tmpNDarray, out=val[i])
              check_diff_to_scalar(val[i], expected, my_rank)
          print("check_broadcast passed: ", val)
  
      # check_broadcast(kv, init_test_keys, shape) #Byteps doesn't support pure CPU training
      # check_broadcast(kv, init_test_keys_big, big_shape) #Byteps doesn't support pure CPU training
      check_broadcast(kv, init_test_keys_device, shape, device=True)
      check_broadcast(
          kv, init_test_keys_device_big, big_shape, device=True
      )
      print("worker " + str(my_rank) + " is initialized")
  
file_path: mxnet/tests/nightly/dist_device_sync_kvstore_byteps.py
imports: import sys
  import mxnet
  import numpy
  import numpy.random
  import time
  import argparse
  from mxnet.log import get_logger
  import logging
  from mxnet.kvstore import BytePS
label_desc: Use image node_id 4 for calling a global function with example usage: test_broadcast() without return types