code: def test_sync_init(gpu_tests=False):
      def get_dtype(idx, cur_keys):
          if idx < len(cur_keys) / 2:
              dtype = "float32"
          else:
              dtype = "float16"
          return dtype
  
      def check_init(kv, cur_keys, cur_shape, device=False):
          ctx = mx.gpu(0) if device else mx.cpu()
          val = [
              mx.nd.zeros(
                  cur_shape, ctx=ctx, dtype=get_dtype(i, cur_keys)
              )
              for i in range(len(cur_keys))
          ]
          for i in range(len(cur_keys)):
              expected = i
              kv.init(
                  cur_keys[i],
                  [
                      mx.nd.ones(
                          cur_shape,
                          ctx=ctx,
                          dtype=get_dtype(i, cur_keys),
                      )
                      * i
                  ],
              )
              kv.pull(cur_keys[i], out=val[i])
              check_diff(val[i], expected)
  
      check_init(kv, init_test_keys, shape)
      check_init(kv, init_test_keys_big, big_shape)
      if gpu_tests:
          check_init(kv, init_test_keys_device, shape, device=True)
          check_init(
              kv, init_test_keys_device_big, big_shape, device=True
          )
      print("worker " + str(kv.rank) + " is initialized")
  
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 8 for calling a global function with example usage: test_sync_init(gpu_tests) and returns: dtype