class_docstr: See linear_with_grad_accumulation_and_async_allreduce
code: def forward(
      ctx,
      input,
      weight,
      bias,
      gradient_accumulation_fusion,
      async_grad_allreduce,
      sequence_parallel,
  ):
      ctx.save_for_backward(input, weight)
      ctx.use_bias = bias is not None
      ctx.gradient_accumulation_fusion = gradient_accumulation_fusion
      ctx.async_grad_allreduce = async_grad_allreduce
      ctx.sequence_parallel = sequence_parallel
  
      if sequence_parallel:
          world_size = get_tensor_model_parallel_world_size()
          dim_size = list(input.size())
          dim_size[0] = dim_size[0] * world_size
  
          all_gather_buffer = get_global_memory_buffer().get_tensor(
              dim_size, input.dtype, "mpu"
          )
          torch.distributed._all_gather_base(
              all_gather_buffer,
              input,
              group=get_tensor_model_parallel_group(),
          )
          total_input = all_gather_buffer
      else:
          total_input = input
  
      output = torch.matmul(total_input, weight.t())
      if bias is not None:
          output = output + bias
      return output
  
imports: import math
  import os
  import warnings
  from typing import Callable, Optional
  import torch
  import torch.nn.functional
  import torch.nn.init
  from torch.cuda.amp import custom_bwd, custom_fwd
  from torch.nn.parameter import Parameter
  from megatron.core.model_parallel_config import ModelParallelConfig
  from megatron.core.parallel_state import get_global_memory_buffer, get_tensor_model_parallel_group, get_tensor_model_parallel_rank, get_tensor_model_parallel_world_size
  from .mappings import copy_to_tensor_model_parallel_region, gather_from_sequence_parallel_region, gather_from_tensor_model_parallel_region, reduce_from_tensor_model_parallel_region, reduce_scatter_to_sequence_parallel_region, scatter_to_tensor_model_parallel_region
  from .random import get_cuda_rng_tracker, get_expert_parallel_rng_tracker_name
  from .utils import VocabUtility, divide, split_tensor_along_last_dim
label_desc: Use image node_id 1 for calling the LinearWithGradAccumulationAndAsyncCommunication obj's underlying member method code with example usage: obj.forward(ctx, input, weight, bias, gradient_accumulation_fusion, async_grad_allreduce, sequence_parallel) and returns: output