class_docstr: A key-value store for synchronization of values, over multiple devices.
class_docstr_tok: ["A","key-value","store","for","synchronization","of","values",",","over","multiple","devices","."]
docstr: Initializes a single or a sequence of key-value pairs into the store.
  
  For each key, one must `init` it before calling `push` or `pull`.
  When multiple workers invoke `init` for the same key, only
  the value supplied by worker with rank `0` is used. This function returns
  after data has been initialized successfully.
  
  Parameters
  ----------
  key : str, int, or sequence of str or int
      The keys.
  value : NDArray, RowSparseNDArray or sequence of NDArray or RowSparseNDArray
      Values corresponding to the keys.
  
  Examples
  --------
  >>> # init a single key-value pair
  >>> shape = (2,3)
  >>> kv = mx.kv.create('local')
  >>> kv.init('3', mx.nd.ones(shape)*2)
  >>> a = mx.nd.zeros(shape)
  >>> kv.pull('3', out=a)
  >>> print a.asnumpy()
  [[ 2.  2.  2.]
  [ 2.  2.  2.]]
  
  >>> # init a list of key-value pairs
  >>> keys = ['5', '7', '9']
  >>> kv.init(keys, [mx.nd.ones(shape)]*len(keys))
  
  >>> # init a row_sparse value
  >>> kv.init('4', mx.nd.ones(shape).tostype('row_sparse'))
  >>> b = mx.nd.sparse.zeros('row_sparse', shape)
  >>> kv.row_sparse_pull('4', row_ids=mx.nd.array([0, 1]), out=b)
  >>> print b
  <RowSparseNDArray 2x3 @cpu(0)>
docstr_tok: ["Initializes","a","single","or","a","sequence","of","key-value","pairs","into","the","store",".","For","each","key",",","one","must","`","init","`","it","before","calling","`","push","`","or","`","pull","`",".","When","multiple","workers","invoke","`","init","`","for","the","same","key",",","only","the","value","supplied","by","worker","with","rank","`","0","`","is","used",".","This","function","returns","after","data","has","been","initialized","successfully",".","Parameters","--","--","--","--","--","key",":","str",",","int",",","or","sequence","of","str","or","int","The","keys",".","value",":","NDArray",",","RowSparseNDArray","or","sequence","of","NDArray","or","RowSparseNDArray","Values","corresponding","to","the","keys",".","Examples","--","--","--","--",">",">",">","#","init","a","single","key-value","pair",">",">",">","shape","=","(","2,3",")",">",">",">","kv","=","mx.kv.create","(","'local","'",")",">",">",">","kv.init","(","'","3","'",",","mx.nd.ones","(","shape",")","*","2",")",">",">",">","a","=","mx.nd.zeros","(","shape",")",">",">",">","kv.pull","(","'","3","'",",","out=a",")",">",">",">","print","a.asnumpy","(",")","[","[","2",".","2",".","2",".","]","[","2",".","2",".","2",".","]","]",">",">",">","#","init","a","list","of","key-value","pairs",">",">",">","keys","=","[","'","5","'",",","'","7","'",",","'","9","'","]",">",">",">","kv.init","(","keys",",","[","mx.nd.ones","(","shape",")","]","*","len","(","keys",")",")",">",">",">","#","init","a","row_sparse","value",">",">",">","kv.init","(","'","4","'",",","mx.nd.ones","(","shape",")",".tostype","(","'row_sparse","'",")",")",">",">",">","b","=","mx.nd.sparse.zeros","(","'row_sparse","'",",","shape",")",">",">",">","kv.row_sparse_pull","(","'","4","'",",","row_ids=mx.nd.array","(","[","0",",","1","]",")",",","out=b",")",">",">",">","print","b","<","RowSparseNDArray","2x3","@","cpu","(","0",")",">"]
code: def init(self, key, value):
      """Initializes a single or a sequence of key-value pairs into the store.
  
      For each key, one must `init` it before calling `push` or `pull`.
      When multiple workers invoke `init` for the same key, only
      the value supplied by worker with rank `0` is used. This function returns
      after data has been initialized successfully.
  
      Parameters
      ----------
      key : str, int, or sequence of str or int
          The keys.
      value : NDArray, RowSparseNDArray or sequence of NDArray or RowSparseNDArray
          Values corresponding to the keys.
  
      Examples
      --------
      >>> # init a single key-value pair
      >>> shape = (2,3)
      >>> kv = mx.kv.create('local')
      >>> kv.init('3', mx.nd.ones(shape)*2)
      >>> a = mx.nd.zeros(shape)
      >>> kv.pull('3', out=a)
      >>> print a.asnumpy()
      [[ 2.  2.  2.]
      [ 2.  2.  2.]]
  
      >>> # init a list of key-value pairs
      >>> keys = ['5', '7', '9']
      >>> kv.init(keys, [mx.nd.ones(shape)]*len(keys))
  
      >>> # init a row_sparse value
      >>> kv.init('4', mx.nd.ones(shape).tostype('row_sparse'))
      >>> b = mx.nd.sparse.zeros('row_sparse', shape)
      >>> kv.row_sparse_pull('4', row_ids=mx.nd.array([0, 1]), out=b)
      >>> print b
      <RowSparseNDArray 2x3 @cpu(0)>
      """
      ckeys, cvals, use_str_keys = _ctype_key_value(key, value)
      if use_str_keys:
          check_call(
              _LIB.MXKVStoreInitEx(
                  self.handle, mx_uint(len(ckeys)), ckeys, cvals
              )
          )
      else:
          check_call(
              _LIB.MXKVStoreInit(
                  self.handle, mx_uint(len(ckeys)), ckeys, cvals
              )
          )
  
imports: import pickle
  import ctypes
  import os
  from ..ndarray import NDArray
  from ..ndarray import _ndarray_cls
  from ..base import _LIB, c_str
  from ..base import check_call, mx_uint, py_str
  from ..base import NDArrayHandle, KVStoreHandle
  from ..None import optimizer
  from .base import _ctype_key_value, _ctype_dict, KVStoreBase
label_desc: Use image node_id 5 for calling the KVStore obj's underlying member method code with example usage: obj.init(key, value) without return types