code: def backward(ctx, output_grad: Tensor) -> Tuple[Tensor, ...]:
      if ctx.reduce_mean:
          return output_grad / ctx.reduce_size, None, None, None
      else:
          return output_grad, None, None, None
  
imports: from typing import Optional, Tuple
  import torch
  from torch import Tensor
  from torch.cuda.amp import custom_bwd, custom_fwd
  from colossalai.legacy.communication import all_gather, all_reduce, broadcast, reduce, reduce_scatter
  from colossalai.legacy.constants import INPUT_GROUP_3D, WEIGHT_GROUP_3D
  from colossalai.legacy.context.parallel_mode import ParallelMode
  from colossalai.legacy.core import global_context
  from ._utils import get_parallel_mode_from_env, push_async_grad
label_desc: Use image node_id 2 for calling the _ReduceByBatch3D obj's underlying member method code with example usage: obj.backward(ctx, output_grad) and returns: unknown,  None,  None,  None, output_grad,  None,  None,  None