code: def test_randomhorizontalflip(p):
      # testing for 2 cases, with flip probability 1 and 0.
      transform = RandomHorizontalFlip(p)
      input_t = torch.ones((3, 32, 32), dtype=torch.float32)
      input_t[..., :16] = 0
      target = {
          "boxes": np.array([[0.1, 0.1, 0.3, 0.4]], dtype=np.float32),
          "labels": np.ones(1, dtype=np.int64),
      }
      transformed, _target = transform(input_t, target)
      assert isinstance(transformed, torch.Tensor)
      assert transformed.shape == input_t.shape
      assert transformed.dtype == input_t.dtype
      # integrity check of targets
      assert isinstance(_target, dict)
      assert all(
          isinstance(val, np.ndarray) for val in _target.values()
      )
      assert _target["boxes"].dtype == np.float32
      assert _target["labels"].dtype == np.int64
      if p == 1:
          assert np.all(
              _target["boxes"]
              == np.array([[0.7, 0.1, 0.9, 0.4]], dtype=np.float32)
          )
          assert torch.all(
              transformed.mean((0, 1))
              == torch.tensor([1] * 16 + [0] * 16, dtype=torch.float32)
          )
      elif p == 0:
          assert np.all(
              _target["boxes"]
              == np.array([[0.1, 0.1, 0.3, 0.4]], dtype=np.float32)
          )
          assert torch.all(
              transformed.mean((0, 1))
              == torch.tensor([0] * 16 + [1] * 16, dtype=torch.float32)
          )
      assert np.all(_target["labels"] == np.ones(1, dtype=np.int64))
  
file_path: doctr/tests/pytorch/test_transforms_pt.py
imports: import math
  import numpy
  import pytest
  import torch
  from doctr.transforms import ChannelShuffle, ColorInversion, GaussianNoise, RandomCrop, RandomHorizontalFlip, RandomRotate, RandomShadow, Resize
  from doctr.transforms.functional import crop_detection, rotate_sample
label_desc: Use image node_id 9 for calling a global function with example usage: test_randomhorizontalflip(p) without return types