class_docstr: Matrix multiplication for :math:`C = A^TB`
  
  Args:
      A (:class:`torch.tensor`): matrix :math:`A`.
      B (:class:`torch.tensor`): matrix :math:`B`.
      tesseract_dim (int): dimension of TESSERACT fo 2.5D parallelism.
      out_shape (:class:`torch.size`): shape of output tensor.
      row_rank (int): the rank of row.
      col_rank (int): the rank of column.
      dep_rank (int): the rank of depth.
      row_parallel_mode (:class:`colossalai.legacy.context.ParallelMode`): row parallel mode.
      col_parallel_mode (:class:`colossalai.legacy.context.ParallelMode`): column parallel mode.
      data_parallel_rank (int): data parallel rank.
      pipeline_parallel_rank (int): pipeline parallel rank
      pipeline_parallel_size (int): pipeline parallel size.
      tensor_parallel_size (int): tensor parallel size.
  
  Note:
      The parallel_mode should be concluded in ``ParallelMode``. More details about ``ParallelMode`` could be found
      in `parallel_mode <https://github.com/hpcaitech/ColossalAI/blob/main/colossalai/context/parallel_mode.py>`_
class_docstr_tok: ["Matrix","multiplication","for",":","math",":","`","C","=","A^TB","`","Args",":","A","(",":","class",":","`","torch.tensor","`",")",":","matrix",":","math",":","`","A","`",".","B","(",":","class",":","`","torch.tensor","`",")",":","matrix",":","math",":","`","B","`",".","tesseract_dim","(","int",")",":","dimension","of","TESSERACT","fo","2.5D","parallelism",".","out_shape","(",":","class",":","`","torch.size","`",")",":","shape","of","output","tensor",".","row_rank","(","int",")",":","the","rank","of","row",".","col_rank","(","int",")",":","the","rank","of","column",".","dep_rank","(","int",")",":","the","rank","of","depth",".","row_parallel_mode","(",":","class",":","`","colossalai.legacy.context.ParallelMode","`",")",":","row","parallel","mode",".","col_parallel_mode","(",":","class",":","`","colossalai.legacy.context.ParallelMode","`",")",":","column","parallel","mode",".","data_parallel_rank","(","int",")",":","data","parallel","rank",".","pipeline_parallel_rank","(","int",")",":","pipeline","parallel","rank","pipeline_parallel_size","(","int",")",":","pipeline","parallel","size",".","tensor_parallel_size","(","int",")",":","tensor","parallel","size",".","Note",":","The","parallel_mode","should","be","concluded","in","``","ParallelMode","``",".","More","details","about","``","ParallelMode","``","could","be","found","in","`","parallel_mode","<","https",":","\/\/github.com\/hpcaitech\/ColossalAI\/blob\/main\/colossalai\/context\/parallel_mode.py",">","`","_"]
code: def backward(ctx: Any, output_grad: Tensor) -> Tuple[Tensor, ...]:
      A, B = ctx.saved_tensors
      with torch.no_grad():
          A_grad = Matmul_ABT_2p5D.apply(
              B,
              output_grad,
              ctx.tesseract_dim,
              ctx.A_shape,
              ctx.row_rank,
              ctx.col_rank,
              ctx.dep_rank,
              ctx.row_parallel_mode,
              ctx.col_parallel_mode,
              ctx.data_parallel_rank,
              ctx.pipeline_parallel_rank,
              ctx.pipeline_parallel_size,
              ctx.tensor_parallel_size,
          )
          B_grad = Matmul_AB_2p5D.apply(
              A,
              output_grad,
              ctx.tesseract_dim,
              ctx.B_shape,
              ctx.row_rank,
              ctx.col_rank,
              ctx.dep_rank,
              ctx.row_parallel_mode,
              ctx.col_parallel_mode,
              ctx.data_parallel_rank,
              ctx.pipeline_parallel_rank,
              ctx.pipeline_parallel_size,
              ctx.tensor_parallel_size,
          )
      return (
          A_grad,
          B_grad,
          None,
          None,
          None,
          None,
          None,
          None,
          None,
          None,
          None,
          None,
          None,
          None,
          None,
      )
  
imports: from typing import Any, Tuple
  import torch
  import torch.distributed
  from torch import Tensor
  from torch.cuda.amp import custom_bwd, custom_fwd
  from colossalai.legacy.communication.collective import all_gather, all_reduce, reduce_scatter
  from colossalai.legacy.context.parallel_mode import ParallelMode
  from colossalai.legacy.core import global_context
  from colossalai.utils import get_current_device
label_desc: Use image node_id 2 for calling the Matmul_ATB_2p5D obj's underlying member method code with example usage: obj.backward(ctx, output_grad) and returns: A_grad,  B_grad,  None,  None,  None,  None,  None,  None,  None,  None,  None,  None,  None,  None,  None