未验证 提交 18596b01 编写于 作者: W will-jl944 提交者: GitHub

fix bug in Pad transform (#2569)

上级 796874cf
...@@ -1845,7 +1845,8 @@ class Pad(BaseOperator): ...@@ -1845,7 +1845,8 @@ class Pad(BaseOperator):
assert pad_mode in [ assert pad_mode in [
-1, 0, 1, 2 -1, 0, 1, 2
], 'currently only supports four modes [-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 = size
self.size_divisor = size_divisor self.size_divisor = size_divisor
...@@ -1912,7 +1913,7 @@ class Pad(BaseOperator): ...@@ -1912,7 +1913,7 @@ class Pad(BaseOperator):
im_h < h and im_w < w im_h < h and im_w < w
), '(h, w) of target size should be greater than (im_h, im_w)' ), '(h, w) of target size should be greater than (im_h, im_w)'
else: 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 w = np.ceil(im_w / self.size_divisor) * self.size_divisor
if h == im_h and w == im_w: if h == im_h and w == im_w:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册