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: Pushes a single or a sequence of key-value pairs into the store.
  
  This function returns immediately after adding an operator to the engine.
  The actual operation is executed asynchronously. If there are consecutive
  pushes to the same key, there is no guarantee on the serialization of pushes.
  The execution of a push does not guarantee that all previous pushes are
  finished.
  There is no synchronization between workers.
  One can use ``_barrier()`` to sync all workers.
  
  Parameters
  ----------
  key : str, int, or sequence of str or int
      Keys.
  
  value : NDArray, RowSparseNDArray, list of NDArray or RowSparseNDArray,
          or list of list of NDArray or RowSparseNDArray
      Values corresponding to the keys.
  
  priority : int, optional
      The priority of the push operation.
      Higher priority push operations are likely to be executed before
      other push actions.
  
  Examples
  --------
  >>> # push a single key-value pair
  >>> shape = (2,3)
  >>> kv.push('3', mx.nd.ones(shape)*8)
  >>> kv.pull('3', out=a) # pull out the value
  >>> print a.asnumpy()
  [[ 8.  8.  8.]
  [ 8.  8.  8.]]
  
  >>> # aggregate the value and the push
  >>> gpus = [mx.gpu(i) for i in range(4)]
  >>> b = [mx.nd.ones(shape, gpu) for gpu in gpus]
  >>> kv.push('3', b)
  >>> kv.pull('3', out=a)
  >>> print a.asnumpy()
  [[ 4.  4.  4.]
  [ 4.  4.  4.]]
  
  >>> # push a list of keys.
  >>> # single device
  >>> keys = ['4', '5', '6']
  >>> kv.push(keys, [mx.nd.ones(shape)]*len(keys))
  >>> b = [mx.nd.zeros(shape)]*len(keys)
  >>> kv.pull(keys, out=b)
  >>> print b[1].asnumpy()
  [[ 1.  1.  1.]
  [ 1.  1.  1.]]
  
  >>> # multiple devices:
  >>> keys = ['7', '8', '9']
  >>> b = [[mx.nd.ones(shape, gpu) for gpu in gpus]] * len(keys)
  >>> kv.push(keys, b)
  >>> kv.pull(keys, out=b)
  >>> print b[1][1].asnumpy()
  [[ 4.  4.  4.]
  [ 4.  4.  4.]]
  
  >>> # push a row_sparse value
  >>> b = mx.nd.sparse.zeros('row_sparse', shape)
  >>> kv.init('10', mx.nd.sparse.zeros('row_sparse', shape))
  >>> kv.push('10', mx.nd.ones(shape).tostype('row_sparse'))
  >>> # pull out the value
  >>> kv.row_sparse_pull('10', row_ids=mx.nd.array([0, 1]), out=b)
  >>> print b
  <RowSparseNDArray 2x3 @cpu(0)>
docstr_tok: ["Pushes","a","single","or","a","sequence","of","key-value","pairs","into","the","store",".","This","function","returns","immediately","after","adding","an","operator","to","the","engine",".","The","actual","operation","is","executed","asynchronously",".","If","there","are","consecutive","pushes","to","the","same","key",",","there","is","no","guarantee","on","the","serialization","of","pushes",".","The","execution","of","a","push","does","not","guarantee","that","all","previous","pushes","are","finished",".","There","is","no","synchronization","between","workers",".","One","can","use","``","_barrier","(",")","``","to","sync","all","workers",".","Parameters","--","--","--","--","--","key",":","str",",","int",",","or","sequence","of","str","or","int","Keys",".","value",":","NDArray",",","RowSparseNDArray",",","list","of","NDArray","or","RowSparseNDArray",",","or","list","of","list","of","NDArray","or","RowSparseNDArray","Values","corresponding","to","the","keys",".","priority",":","int",",","optional","The","priority","of","the","push","operation",".","Higher","priority","push","operations","are","likely","to","be","executed","before","other","push","actions",".","Examples","--","--","--","--",">",">",">","#","push","a","single","key-value","pair",">",">",">","shape","=","(","2,3",")",">",">",">","kv.push","(","'","3","'",",","mx.nd.ones","(","shape",")","*","8",")",">",">",">","kv.pull","(","'","3","'",",","out=a",")","#","pull","out","the","value",">",">",">","print","a.asnumpy","(",")","[","[","8",".","8",".","8",".","]","[","8",".","8",".","8",".","]","]",">",">",">","#","aggregate","the","value","and","the","push",">",">",">","gpus","=","[","mx.gpu","(","i",")","for","i","in","range","(","4",")","]",">",">",">","b","=","[","mx.nd.ones","(","shape",",","gpu",")","for","gpu","in","gpus","]",">",">",">","kv.push","(","'","3","'",",","b",")",">",">",">","kv.pull","(","'","3","'",",","out=a",")",">",">",">","print","a.asnumpy","(",")","[","[","4",".","4",".","4",".","]","[","4",".","4",".","4",".","]","]",">",">",">","#","push","a","list","of","keys",".",">",">",">","#","single","device",">",">",">","keys","=","[","'","4","'",",","'","5","'",",","'","6","'","]",">",">",">","kv.push","(","keys",",","[","mx.nd.ones","(","shape",")","]","*","len","(","keys",")",")",">",">",">","b","=","[","mx.nd.zeros","(","shape",")","]","*","len","(","keys",")",">",">",">","kv.pull","(","keys",",","out=b",")",">",">",">","print","b","[","1","]",".asnumpy","(",")","[","[","1",".","1",".","1",".","]","[","1",".","1",".","1",".","]","]",">",">",">","#","multiple","devices",":",">",">",">","keys","=","[","'","7","'",",","'","8","'",",","'","9","'","]",">",">",">","b","=","[","[","mx.nd.ones","(","shape",",","gpu",")","for","gpu","in","gpus","]","]","*","len","(","keys",")",">",">",">","kv.push","(","keys",",","b",")",">",">",">","kv.pull","(","keys",",","out=b",")",">",">",">","print","b","[","1","]","[","1","]",".asnumpy","(",")","[","[","4",".","4",".","4",".","]","[","4",".","4",".","4",".","]","]",">",">",">","#","push","a","row_sparse","value",">",">",">","b","=","mx.nd.sparse.zeros","(","'row_sparse","'",",","shape",")",">",">",">","kv.init","(","'10","'",",","mx.nd.sparse.zeros","(","'row_sparse","'",",","shape",")",")",">",">",">","kv.push","(","'10","'",",","mx.nd.ones","(","shape",")",".tostype","(","'row_sparse","'",")",")",">",">",">","#","pull","out","the","value",">",">",">","kv.row_sparse_pull","(","'10","'",",","row_ids=mx.nd.array","(","[","0",",","1","]",")",",","out=b",")",">",">",">","print","b","<","RowSparseNDArray","2x3","@","cpu","(","0",")",">"]
code: def push(self, key, value, priority=0):
      """Pushes a single or a sequence of key-value pairs into the store.
  
      This function returns immediately after adding an operator to the engine.
      The actual operation is executed asynchronously. If there are consecutive
      pushes to the same key, there is no guarantee on the serialization of pushes.
      The execution of a push does not guarantee that all previous pushes are
      finished.
      There is no synchronization between workers.
      One can use ``_barrier()`` to sync all workers.
  
      Parameters
      ----------
      key : str, int, or sequence of str or int
          Keys.
  
      value : NDArray, RowSparseNDArray, list of NDArray or RowSparseNDArray,
              or list of list of NDArray or RowSparseNDArray
          Values corresponding to the keys.
  
      priority : int, optional
          The priority of the push operation.
          Higher priority push operations are likely to be executed before
          other push actions.
  
      Examples
      --------
      >>> # push a single key-value pair
      >>> shape = (2,3)
      >>> kv.push('3', mx.nd.ones(shape)*8)
      >>> kv.pull('3', out=a) # pull out the value
      >>> print a.asnumpy()
      [[ 8.  8.  8.]
      [ 8.  8.  8.]]
  
      >>> # aggregate the value and the push
      >>> gpus = [mx.gpu(i) for i in range(4)]
      >>> b = [mx.nd.ones(shape, gpu) for gpu in gpus]
      >>> kv.push('3', b)
      >>> kv.pull('3', out=a)
      >>> print a.asnumpy()
      [[ 4.  4.  4.]
      [ 4.  4.  4.]]
  
      >>> # push a list of keys.
      >>> # single device
      >>> keys = ['4', '5', '6']
      >>> kv.push(keys, [mx.nd.ones(shape)]*len(keys))
      >>> b = [mx.nd.zeros(shape)]*len(keys)
      >>> kv.pull(keys, out=b)
      >>> print b[1].asnumpy()
      [[ 1.  1.  1.]
      [ 1.  1.  1.]]
  
      >>> # multiple devices:
      >>> keys = ['7', '8', '9']
      >>> b = [[mx.nd.ones(shape, gpu) for gpu in gpus]] * len(keys)
      >>> kv.push(keys, b)
      >>> kv.pull(keys, out=b)
      >>> print b[1][1].asnumpy()
      [[ 4.  4.  4.]
      [ 4.  4.  4.]]
  
      >>> # push a row_sparse value
      >>> b = mx.nd.sparse.zeros('row_sparse', shape)
      >>> kv.init('10', mx.nd.sparse.zeros('row_sparse', shape))
      >>> kv.push('10', mx.nd.ones(shape).tostype('row_sparse'))
      >>> # pull out the value
      >>> kv.row_sparse_pull('10', 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.MXKVStorePushEx(
                  self.handle,
                  mx_uint(len(ckeys)),
                  ckeys,
                  cvals,
                  ctypes.c_int(priority),
              )
          )
      else:
          check_call(
              _LIB.MXKVStorePush(
                  self.handle,
                  mx_uint(len(ckeys)),
                  ckeys,
                  cvals,
                  ctypes.c_int(priority),
              )
          )
  
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 6 for calling the KVStore obj's underlying member method code with example usage: obj.push(key, value, priority) without return types