class_docstr: BytePS backend for MXNet KVStore interface.
docstr: Performs push and pull a single value from the store.
  This function is coalesced form of push and pull operations.
  `value` is pushed to the kvstore server for the specified keys and the aggregated
  values are pulled from the server to `out`. If `out` is not specified the pulled
  values are written to `value`.
  
  Parameters
  ----------
  key : str, or int
      The key.
  value : NDArray, or list of NDArray
      Values corresponding to the key.
  out: NDArray, or list of NDArray
      Values corresponding to the key.
  priority : int, optional
      The priority of the operation.
      Higher priority operations are likely to be executed before other actions.
  
  Examples
  --------
  >>> # pushpull a single key-value pair
  >>> kv.pushpull('3', mx.nd.ones(shape)*8, out=a)
  >>> print a.asnumpy()
  [[ 8.  8.  8.]
  [ 8.  8.  8.]]
docstr_tok: ["Performs","push","and","pull","a","single","value","from","the","store",".","This","function","is","coalesced","form","of","push","and","pull","operations",".","`","value","`","is","pushed","to","the","kvstore","server","for","the","specified","keys","and","the","aggregated","values","are","pulled","from","the","server","to","`","out","`",".","If","`","out","`","is","not","specified","the","pulled","values","are","written","to","`","value","`",".","Parameters","--","--","--","--","--","key",":","str",",","or","int","The","key",".","value",":","NDArray",",","or","list","of","NDArray","Values","corresponding","to","the","key",".","out",":","NDArray",",","or","list","of","NDArray","Values","corresponding","to","the","key",".","priority",":","int",",","optional","The","priority","of","the","operation",".","Higher","priority","operations","are","likely","to","be","executed","before","other","actions",".","Examples","--","--","--","--",">",">",">","#","pushpull","a","single","key-value","pair",">",">",">","kv.pushpull","(","'","3","'",",","mx.nd.ones","(","shape",")","*","8",",","out=a",")",">",">",">","print","a.asnumpy","(",")","[","[","8",".","8",".","8",".","]","[","8",".","8",".","8",".","]","]"]
code: def pushpull(self, key, value, out=None, priority=0):
      """Performs push and pull a single value from the store.
      This function is coalesced form of push and pull operations.
      `value` is pushed to the kvstore server for the specified keys and the aggregated
      values are pulled from the server to `out`. If `out` is not specified the pulled
      values are written to `value`.
  
      Parameters
      ----------
      key : str, or int
          The key.
      value : NDArray, or list of NDArray
          Values corresponding to the key.
      out: NDArray, or list of NDArray
          Values corresponding to the key.
      priority : int, optional
          The priority of the operation.
          Higher priority operations are likely to be executed before other actions.
  
      Examples
      --------
      >>> # pushpull a single key-value pair
      >>> kv.pushpull('3', mx.nd.ones(shape)*8, out=a)
      >>> print a.asnumpy()
      [[ 8.  8.  8.]
      [ 8.  8.  8.]]
      """
      # the most common operation operates on one NDArray as `value`, and
      # `out` is set to None, for inplace pushpull.
  
      assert isinstance(key, (str, int))
  
      # unpack the list if it contains just one NDArray
      value = (
          value[0]
          if isinstance(value, list) and len(value) == 1
          else value
      )
      assert isinstance(
          value, NDArray
      ), "The type of value can only be NDArray or list of NDArray which has only one element."
      assert (
          value.context.device_type == "gpu"
      ), "Byteps KVStore only support GPU context for pushpull value"
  
      # optimzation when out = value or out = [value]
      if isinstance(out, (list, tuple)) and len(out) == 1:
          inplace = value is out[0]
      else:
          inplace = value is out
  
      if inplace:
          pushpull_value = value
      else:
          pushpull_value = value.copy()
  
      self.handle.byteps_declare_tensor(str(key))
      self.handle.byteps_push_pull(
          pushpull_value,
          version=0,
          priority=priority,
          name=str(key),
          is_average=False,
      )
  
      if out is not None:
          out = out if isinstance(out, list) else [out]
          for o in out:
              pushpull_value.copyto(o)
  
file_path: mxnet/python/mxnet/kvstore/byteps.py
imports: from __future__ import absolute_import
  from ..ndarray import NDArray
  from .base import KVStoreBase
label_desc: Use image node_id 3 for calling the BytePS obj's underlying member method code with example usage: obj.pushpull(key, value, out, priority) without return types