class_docstr: Randomly flip the input image horizontally
class_docstr_tok: ["Randomly","flip","the","input","image","horizontally"]
code: def forward(
      self, img: Union[torch.Tensor, Image], target: Dict[str, Any]
  ) -> Tuple[Union[torch.Tensor, Image], Dict[str, Any]]:
      if torch.rand(1) < self.p:
          _img = F.hflip(img)
          _target = target.copy()
          # Changing the relative bbox coordinates
          _target["boxes"][:, ::2] = 1 - target["boxes"][:, [2, 0]]
          return _img, _target
      return img, target
  
imports: import math
  from typing import Any, Dict, Optional, Tuple, Union
  import numpy
  import torch
  from PIL.Image import Image
  from torch.nn.functional import pad
  from torchvision.transforms import functional
  from torchvision.transforms import transforms
  from ..functional.pytorch import random_shadow
label_desc: Use image node_id 1 for calling the RandomHorizontalFlip obj's underlying member method code with example usage: obj.forward(img, target) and returns: img,  target, _img,  _target