parameters: (self, input, mode="sum", comm_world="worker")
return_statement: return self.role_maker._all_reduce(input, mode, comm_world)
docstring: All reduce `input` between specified collection. This is a distributed API.
  
          Args:
              input (list|numpy.array): The input variable to do all_reduce between specified collection.
              mode (str): "sum" or "min" or "max".
              comm_world (str, optional): Collection used to execute all_reduce operation. Supported collections incude `worker` , `server` and `all` . The default is `worker` .
  
          Returns:
              output(Numpy.array|None): A numpy array with the same shape as the `input` .
  
          Examples:
              .. code-block:: python
  
                  # Save the following code in `train.py` , and then execute the command `fleetrun --server_num 2 --worker_num 2 train.py` .
                  import paddle.distributed.fleet as fleet
                  from paddle.distributed.fleet import PaddleCloudRoleMaker
                  import sys
                  import numpy as np
                  import os
  
                  os.environ["PADDLE_WITH_GLOO"] = "2"
  
                  def train():
                      role = PaddleCloudRoleMaker(
                          is_collective=False,
                          init_gloo=True,
                          path="./tmp_gloo")
                      fleet.init(role)
  
                      if fleet.is_server():
                          input = [1, 2]
                          output = fleet.util.all_reduce(input, "sum", "server")
                          print(output)
                          # [2, 4]
                      elif fleet.is_worker():
                          input = np.array([3, 4])
                          output = fleet.util.all_reduce(input, "sum", "worker")
                          print(output)
                          # [6, 8]
                      output = fleet.util.all_reduce(input, "sum", "all")
                      print(output)
                      # [8, 12]
                  if __name__ == "__main__":
                      train()
docstring_summary: All reduce `input` between specified collection. This is a distributed API.
docstring_tokens: All reduce input between specified collection . This is a distributed API .
function: def all_reduce(self, input, mode="sum", comm_world="worker"):
          """
          All reduce `input` between specified collection. This is a distributed API.
  
          Args:
              input (list|numpy.array): The input variable to do all_reduce between specified collection.
              mode (str): "sum" or "min" or "max".
              comm_world (str, optional): Collection used to execute all_reduce operation. Supported collections incude `worker` , `server` and `all` . The default is `worker` .
  
          Returns:
              output(Numpy.array|None): A numpy array with the same shape as the `input` .
  
          Examples:
              .. code-block:: python
  
                  # Save the following code in `train.py` , and then execute the command `fleetrun --server_num 2 --worker_num 2 train.py` .
                  import paddle.distributed.fleet as fleet
                  from paddle.distributed.fleet import PaddleCloudRoleMaker
                  import sys
                  import numpy as np
                  import os
  
                  os.environ["PADDLE_WITH_GLOO"] = "2"
  
                  def train():
                      role = PaddleCloudRoleMaker(
                          is_collective=False,
                          init_gloo=True,
                          path="./tmp_gloo")
                      fleet.init(role)
  
                      if fleet.is_server():
                          input = [1, 2]
                          output = fleet.util.all_reduce(input, "sum", "server")
                          print(output)
                          # [2, 4]
                      elif fleet.is_worker():
                          input = np.array([3, 4])
                          output = fleet.util.all_reduce(input, "sum", "worker")
                          print(output)
                          # [6, 8]
                      output = fleet.util.all_reduce(input, "sum", "all")
                      print(output)
                      # [8, 12]
                  if __name__ == "__main__":
                      train()
          """
          return self.role_maker._all_reduce(input, mode, comm_world)
function_tokens: def all_reduce ( self , input , mode = "sum" , comm_world = "worker" ) : return self . role_maker . _all_reduce ( input , mode , comm_world )