code: def test_flip(self):
      img_shape = [50, 85]
      # horizontal flip
      th_boxes = torch.Tensor([10, 10, 20, 20]).reshape(1, 1, 4)
      flipped_boxes_th = torch.Tensor([65, 10, 75, 20]).reshape(1, 1, 4)
      boxes = HorizontalBoxes(th_boxes)
      boxes.flip_(img_shape, direction="horizontal")
      assert_allclose(boxes.tensor, flipped_boxes_th)
      # vertical flip
      th_boxes = torch.Tensor([10, 10, 20, 20]).reshape(1, 1, 4)
      flipped_boxes_th = torch.Tensor([10, 30, 20, 40]).reshape(1, 1, 4)
      boxes = HorizontalBoxes(th_boxes)
      boxes.flip_(img_shape, direction="vertical")
      assert_allclose(boxes.tensor, flipped_boxes_th)
      # diagonal flip
      th_boxes = torch.Tensor([10, 10, 20, 20]).reshape(1, 1, 4)
      flipped_boxes_th = torch.Tensor([65, 30, 75, 40]).reshape(1, 1, 4)
      boxes = HorizontalBoxes(th_boxes)
      boxes.flip_(img_shape, direction="diagonal")
      assert_allclose(boxes.tensor, flipped_boxes_th)
  
imports: import random
  from math import sqrt
  from unittest import TestCase
  import cv2
  import numpy
  import torch
  from mmengine.testing import assert_allclose
  from mmdet.structures.bbox import HorizontalBoxes
  from mmdet.structures.mask import BitmapMasks, PolygonMasks
label_desc: Use image node_id 4 for calling the TestHorizontalBoxes obj's underlying member method code with example usage: obj.test_flip() without return types