code: def d4_image_augment(image: Tensor) -> Tensor:
      """
      Augment input tensor using D4 symmetry group
      Args:
          image: Tensor of [B,C,H,W] shape
  
      Returns:
          Tensor of [B * 8, C, H, W] shape with:
              - Original tensor
              - Original tensor rotated by 90 degrees
              - Original tensor rotated by 180 degrees
              - Original tensor rotated by 180 degrees
              - Transposed tensor
              - Transposed tensor rotated by 90 degrees
              - Transposed tensor rotated by 180 degrees
              - Transposed tensor rotated by 180 degrees
  
      """
      if not torch.jit.is_scripting() and not torch.jit.is_tracing():
          if image.size(2) != image.size(3):
              raise ValueError(
                  f"Input tensor must have number of rows equal to number of cols. Got input tensor of shape {image.size()}"
              )
  
      image_t = F.torch_transpose(image)
      return torch.cat(
          [
              image,
              F.torch_rot90_cw(image),
              F.torch_rot180(image),
              F.torch_rot90_ccw(image),
              image_t,
              F.torch_rot90_cw(image_t),
              F.torch_rot180(image_t),
              F.torch_rot90_ccw(image_t),
          ],
          dim=0,
      )
  
imports: from collections import defaultdict
  from functools import partial
  from typing import Tuple, List, Optional, Union, Callable, Dict, Mapping
  import torch
  from torch import Tensor, nn
  from .None import functional
  from ..utils.support import pytorch_toolbelt_deprecated
label_desc: Use image node_id 18 for calling a global function with example usage: d4_image_augment(image) and returns: torch