class_docstr: GroupGather performs all gather on each of the local process/ GPU groups.
class_docstr_tok: ["GroupGather","performs","all","gather","on","each","of","the","local","process\/","GPU","groups","."]
docstr: Perform backwarding, gathering the gradients across different process/ GPU
  group.
docstr_tok: ["Perform","backwarding",",","gathering","the","gradients","across","different","process\/","GPU","group","."]
code: def backward(ctx, grad_output):
      """
      Perform backwarding, gathering the gradients across different process/ GPU
      group.
      """
      grad_output_list = [
          torch.zeros_like(grad_output) for k in range(get_local_size())
      ]
      dist.all_gather(
          grad_output_list,
          grad_output,
          async_op=False,
          group=get_local_process_group(),
      )
  
      grads = torch.stack(grad_output_list, dim=0)
      if ctx.num_groups > 1:
          rank = get_local_rank()
          group_idx = rank // ctx.num_sync_devices
          grads = grads[
              group_idx
              * ctx.num_sync_devices : (group_idx + 1)
              * ctx.num_sync_devices
          ]
      grads = torch.sum(grads, dim=0)
      return grads, None, None
  
file_path: pytorchvideo/pytorchvideo/layers/distributed.py
imports: import torch
  import torch.distributed
  from torch._C._distributed_c10d import ProcessGroup
  from torch.autograd.function import Function
label_desc: Use image node_id 2 for calling the GroupGather obj's underlying member method code with example usage: obj.backward(ctx, grad_output) and returns: grads,  None,  None