class_docstr: AllGatherWithGradient
class_docstr_tok: ["AllGatherWithGradient"]
code: def forward(ctx, input):
      world_size = dist.get_world_size()
      x_gather = [torch.ones_like(input) for _ in range(world_size)]
      torch.distributed.all_gather(x_gather, input, async_op=False)
      x_gather = torch.cat(x_gather, dim=0)
      return x_gather
  
imports: import functools
  import logging
  import pickle
  import torch
  import torch.distributed
  from pytorchvideo.layers.distributed import cat_all_gather, get_local_process_group, get_local_rank, get_local_size, get_world_size, init_distributed_training
label_desc: Use image node_id 1 for calling the AllGatherWithGradient obj's underlying member method code with example usage: obj.forward(ctx, input) and returns: x_gather