class torchvision.transforms.v2.RandomVerticalFlip(p: float = 0.5)[source]

[BETA] Vertically flip the input with a given probability.


The RandomVerticalFlip transform is in Beta stage, and while we do not expect disruptive breaking changes, some APIs may slightly change according to user feedback. Please submit any feedback you may have in this issue:

If the input is a torch.Tensor or a TVTensor (e.g. Image, Video, BoundingBoxes etc.) it can have arbitrary number of leading batch dimensions. For example, the image can have [..., C, H, W] shape. A bounding box can have [..., 4] shape.


p (float, optional) – probability of the input being flipped. Default value is 0.5

Examples using RandomVerticalFlip:

Illustration of transforms

Illustration of transforms


Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources