From 18596b0146c6a0fd8afce2b74b5f8912797eccb4 Mon Sep 17 00:00:00 2001 From: will-jl944 Date: Wed, 9 Jun 2021 12:58:48 +0800 Subject: [PATCH] fix bug in Pad transform (#2569) --- ppdet/data/transform/operators.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ppdet/data/transform/operators.py b/ppdet/data/transform/operators.py index f2c41c12c..b37603f87 100644 --- a/ppdet/data/transform/operators.py +++ b/ppdet/data/transform/operators.py @@ -1845,7 +1845,8 @@ class Pad(BaseOperator): assert pad_mode in [ -1, 0, 1, 2 ], 'currently only supports four modes [-1, 0, 1, 2]' - assert pad_mode == -1 and offsets, 'if pad_mode is -1, offsets should not be None' + if pad_mode == -1: + assert offsets, 'if pad_mode is -1, offsets should not be None' self.size = size self.size_divisor = size_divisor @@ -1912,7 +1913,7 @@ class Pad(BaseOperator): im_h < h and im_w < w ), '(h, w) of target size should be greater than (im_h, im_w)' else: - h = np.ceil(im_h // self.size_divisor) * self.size_divisor + h = np.ceil(im_h / self.size_divisor) * self.size_divisor w = np.ceil(im_w / self.size_divisor) * self.size_divisor if h == im_h and w == im_w: -- GitLab