code: def bbox_flip(bboxes, img_shape, direction="horizontal"):
      """Flip bboxes horizontally or vertically.
  
      Args:
          bboxes (Tensor): Shape (..., 4*k)
          img_shape (tuple): Image shape.
          direction (str): Flip direction, options are "horizontal", "vertical",
              "diagonal". Default: "horizontal"
  
      Returns:
          Tensor: Flipped bboxes.
      """
      assert bboxes.shape[-1] % 4 == 0
      assert direction in ["horizontal", "vertical", "diagonal"]
      flipped = bboxes.clone()
      if direction == "horizontal":
          flipped[..., 0::4] = img_shape[1] - bboxes[..., 2::4]
          flipped[..., 2::4] = img_shape[1] - bboxes[..., 0::4]
      elif direction == "vertical":
          flipped[..., 1::4] = img_shape[0] - bboxes[..., 3::4]
          flipped[..., 3::4] = img_shape[0] - bboxes[..., 1::4]
      else:
          flipped[..., 0::4] = img_shape[1] - bboxes[..., 2::4]
          flipped[..., 1::4] = img_shape[0] - bboxes[..., 3::4]
          flipped[..., 2::4] = img_shape[1] - bboxes[..., 0::4]
          flipped[..., 3::4] = img_shape[0] - bboxes[..., 1::4]
      return flipped
  
file_path: insightface/detection/scrfd/mmdet/core/bbox/transforms.py
imports: import numpy
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: bbox_flip(bboxes, img_shape, direction) and returns: flipped