(tensor, axis_name=None)
Mean all-reduction.

  Args:
    tensor: A tensor.
    axis_name: The axis name to reduce. Must equal to that of the surrounding
      pmap.

  Returns:
    The mean of the `tensor` replicas on each participating devices.
Mean all-reduction.
Mean all - reduction .
def pmean(tensor, axis_name=None):
  """Mean all-reduction.

  Args:
    tensor: A tensor.
    axis_name: The axis name to reduce. Must equal to that of the surrounding
      pmap.

  Returns:
    The mean of the `tensor` replicas on each participating devices.
  """
  if axis_name != _pmap_config.axis_name():
    raise ValueError("axis_name (%s) is not equal to that of the surrounding "
                     "pmap (%s)" % (axis_name, _pmap_config.axis_name()))
  devices = _pmap_config.devices()
  if devices is None:
    raise ValueError("Can't retrieve the device list from the surrounding pmap")
  if tpu_devices(devices):
    # TODO(wangpeng): Implement this.
    raise ValueError("pmean for TPU is not supported yet.")
  else:
    return tf.raw_ops.CollectiveReduce(
        input=tensor,
        group_size=len(devices),
        group_key=_GROUP_KEY,
        instance_key=_get_instance_key(),
        merge_op="Add",
        final_op="Div",
        subdiv_offsets=(0,))
def pmean ( tensor , axis_name = None ) : if axis_name != _pmap_config . axis_name ( ) : raise ValueError ( "axis_name (%s) is not equal to that of the surrounding " "pmap (%s)" % ( axis_name , _pmap_config . axis_name ( ) ) ) devices = _pmap_config . devices ( ) if devices is None : raise ValueError ( "Can't retrieve the device list from the surrounding pmap" ) if tpu_devices ( devices ) : # TODO(wangpeng): Implement this. raise ValueError ( "pmean for TPU is not supported yet." ) else : return tf . raw_ops . CollectiveReduce ( input = tensor , group_size = len ( devices ) , group_key = _GROUP_KEY , instance_key = _get_instance_key ( ) , merge_op = "Add" , final_op = "Div" , subdiv_offsets = ( 0 , ) )