class_docstr: A communication backend using Horovod.
class_docstr_tok: ["A","communication","backend","using","Horovod","."]
docstr: Broadcast the `value` NDArray at rank 0 to all ranks
  
  Parameters
  ----------
  key : str, or int
      The key is used to name the tensor for allreduce. Its
      usage is different from that of parameter servers.
  
  value : NDArray
      The tensor that is to be broadcasted.
  
  out : NDArray, list of NDArray
      Output tensor that receives value broadcasted from root process
  
  priority : int, optional
      The priority of the operation.
      Higher priority operations are likely to be executed before other actions.
  
  Examples
  --------
  >>> a = mx.nd.ones(shape)
  >>> b = mx.nd.zeros(shape)
  >>> kv.broadcast('2', value=a, out=b)
  >>> print(b.asnumpy)
  [[ 1.  1.  1.]
  [ 1.  1.  1.]]
docstr_tok: ["Broadcast","the","`","value","`","NDArray","at","rank","0","to","all","ranks","Parameters","--","--","--","--","--","key",":","str",",","or","int","The","key","is","used","to","name","the","tensor","for","allreduce",".","Its","usage","is","different","from","that","of","parameter","servers",".","value",":","NDArray","The","tensor","that","is","to","be","broadcasted",".","out",":","NDArray",",","list","of","NDArray","Output","tensor","that","receives","value","broadcasted","from","root","process","priority",":","int",",","optional","The","priority","of","the","operation",".","Higher","priority","operations","are","likely","to","be","executed","before","other","actions",".","Examples","--","--","--","--",">",">",">","a","=","mx.nd.ones","(","shape",")",">",">",">","b","=","mx.nd.zeros","(","shape",")",">",">",">","kv.broadcast","(","'","2","'",",","value=a",",","out=b",")",">",">",">","print","(","b.asnumpy",")","[","[","1",".","1",".","1",".","]","[","1",".","1",".","1",".","]","]"]
code: def broadcast(self, key, value, out, priority=0):
      """Broadcast the `value` NDArray at rank 0 to all ranks
  
      Parameters
      ----------
      key : str, or int
          The key is used to name the tensor for allreduce. Its
          usage is different from that of parameter servers.
  
      value : NDArray
          The tensor that is to be broadcasted.
  
      out : NDArray, list of NDArray
          Output tensor that receives value broadcasted from root process
  
      priority : int, optional
          The priority of the operation.
          Higher priority operations are likely to be executed before other actions.
  
      Examples
      --------
      >>> a = mx.nd.ones(shape)
      >>> b = mx.nd.zeros(shape)
      >>> kv.broadcast('2', value=a, out=b)
      >>> print(b.asnumpy)
      [[ 1.  1.  1.]
      [ 1.  1.  1.]]
      """
      import horovod.mxnet as hvd
  
      out = out if isinstance(out, list) else [out]
  
      # TODO (lnyuan): need to copy data to each device memory
      for o in out:
          o[:] = hvd.broadcast(
              tensor=value,
              root_rank=0,
              name=str(key),
              priority=priority,
          )
  
file_path: mxnet/python/mxnet/kvstore/horovod.py
imports: from __future__ import absolute_import
  from .base import KVStoreBase
label_desc: Use image node_id 3 for calling the Horovod obj's underlying member method code with example usage: obj.broadcast(key, value, out, priority) without return types