From 77a880c0cdb01dc3c517bd83bec06063d6fa61c9 Mon Sep 17 00:00:00 2001 From: IMMORTAL <66876429+IamDestiny@users.noreply.github.com> Date: Fri, 25 Jun 2021 17:56:36 +0800 Subject: [PATCH] fix random probability (#33751) * fix random probability * fix random probability --- python/paddle/vision/transforms/transforms.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/paddle/vision/transforms/transforms.py b/python/paddle/vision/transforms/transforms.py index 27eca19c28b..c09748913f9 100644 --- a/python/paddle/vision/transforms/transforms.py +++ b/python/paddle/vision/transforms/transforms.py @@ -555,6 +555,7 @@ class RandomHorizontalFlip(BaseTransform): def __init__(self, prob=0.5, keys=None): super(RandomHorizontalFlip, self).__init__(keys) + assert 0 <= prob <= 1, "probability must be between 0 and 1" self.prob = prob def _apply_image(self, img): @@ -589,6 +590,7 @@ class RandomVerticalFlip(BaseTransform): def __init__(self, prob=0.5, keys=None): super(RandomVerticalFlip, self).__init__(keys) + assert 0 <= prob <= 1, "probability must be between 0 and 1" self.prob = prob def _apply_image(self, img): -- GitLab