Commit 3ccc1dfd authored by Hadi Kazemi's avatar Hadi Kazemi Committed by Soumith Chintala
Browse files

Update Pad class in transforms.py (#214)

isinstance(padding, tuple) is added to the padding assertion to be able to pass a sequence.
parent 611c2348
...@@ -235,11 +235,12 @@ class Pad(object): ...@@ -235,11 +235,12 @@ class Pad(object):
Args: Args:
padding (int or sequence): Padding on each border. If a sequence of padding (int or sequence): Padding on each border. If a sequence of
length 4, it is used to pad left, top, right and bottom borders respectively. length 4, it is used to pad left, top, right and bottom borders respectively.
fill: Pixel fill value. Default is 0. fill: Pixel fill value. Default is 0. If a sequence of
length 3, it is used to fill R, G, B channels respectively.
""" """
def __init__(self, padding, fill=0): def __init__(self, padding, fill=0):
assert isinstance(padding, numbers.Number) assert isinstance(padding, numbers.Number) or isinstance(padding, tuple)
assert isinstance(fill, numbers.Number) or isinstance(fill, str) or isinstance(fill, tuple) assert isinstance(fill, numbers.Number) or isinstance(fill, str) or isinstance(fill, tuple)
self.padding = padding self.padding = padding
self.fill = fill self.fill = fill
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment