class_docstr: Gather input from sequence parallel in forward and reduce-scatter gradient in backward
  
  Args:
      input_ (`torch.Tensor`): The input tensor from sequence parallel region.
      process_group (`torch.distributed.ProcessGroup`): The process group used for collective communication.
      overlap (`bool`): Whther to overlap the all_gather op and gradient calculate in backward.
class_docstr_tok: ["Gather","input","from","sequence","parallel","in","forward","and","reduce-scatter","gradient","in","backward","Args",":","input_","(","`","torch.Tensor","`",")",":","The","input","tensor","from","sequence","parallel","region",".","process_group","(","`","torch.distributed.ProcessGroup","`",")",":","The","process","group","used","for","collective","communication",".","overlap","(","`","bool","`",")",":","Whther","to","overlap","the","all_gather","op","and","gradient","calculate","in","backward","."]
code: def forward(
      ctx,
      input_,
      weight,
      bias,
      process_group,
      async_grad_reduce_scatter,
      dim,
      overlap=True,
  ):
      ctx.save_for_backward(input_, weight, bias)
      ctx.use_bias = bias is not None
      ctx.process_group = process_group
      ctx.async_grad_reduce_scatter = async_grad_reduce_scatter
      ctx.dim = dim
      ctx.overlap = overlap
  
      input_parallel = _gather(input_, dim, process_group)
  
      if bias is not None:
          output = F.linear(input_parallel, weight, bias)
      else:
          output = F.linear(input_parallel, weight)
  
      return output
  
imports: import torch
  import torch.distributed
  import torch.nn.functional
label_desc: Use image node_id 1 for calling the _LinearWithGatherForwardReduceScatterBackward obj's underlying member method code with example usage: obj.forward(ctx, input_, weight, bias, process_group, async_grad_reduce_scatter, dim, overlap) and returns: output