RandomVerticalFlip¶ class torchvision.transforms.RandomVerticalFlip(p=0.5)[source]¶ 以给定的概率随机垂直翻转给定的图像。如果图像是 torch Tensor,则期望其形状为 […, H, W],其中 … 表示任意数量的前导维度。 参数: p (float) – 图像被翻转的概率。默认值为 0.5 使用 RandomVerticalFlip 的示例 变换图示 变换图示 forward(img)[source]¶ 参数: img (PIL Image 或 Tensor) – 要翻转的图像。 返回: 随机翻转后的图像。 返回类型: PIL Image 或 Tensor