code: def all_reduce_sum_with_grad(tensor, group=0):
      """
      Reduce a tensor over all ranks so that all get the result.
      Args:
          tensor (Tensor): The input Tensor. It also works as the output Tensor. Its data type
              should be float16, float32, float64, int32 or int64.
          op (ReduceOp.SUM|ReduceOp.MAX|ReduceOp.Min|ReduceOp.PROD): Optional. The operation used.
          group (int): Optional. The process group to work on.
      Returns:
          None.
      Examples:
          .. code-block:: python
              import numpy as np
              import paddle
              from paddle.distributed import ReduceOp
              from paddle.distributed import init_parallel_env
              paddle.disable_static()
              paddle.set_device('gpu:%d'%paddle.distributed.ParallelEnv().dev_id)
              init_parallel_env()
              if paddle.distributed.ParallelEnv().local_rank == 0:
                  np_data = np.array([[4, 5, 6], [4, 5, 6]], dtype="float32")
              else:
                  np_data = np.array([[1, 2, 3], [1, 2, 3]], dtype="float32")
              data = paddle.to_tensor(np_data)
              data.stop_gradient = False
              output = all_reduce_sum_with_grad(data)
              paddle.sum(output).backward()
              print(data.gradient())
              [[ 0.5, 0.5, 0.5], [0.5, 0.5, 0.5]]
  
      """
      return _legacy_C_ops.c_allreduce_sum(
          tensor, "ring_id", group, "use_calc_stream", True
      )
  
file_path: PGL/pgl/utils/op.py
imports: import paddle
  from paddle import _C_ops, _legacy_C_ops
  import numpy
  from pgl.utils.helper import check_is_tensor
label_desc: Use image node_id 3 for calling a global function with example usage: all_reduce_sum_with_grad(tensor, group) and returns: _legacy_C_ops