Skip to content

Commit 39772ec

Browse files
pmeierdatumbox
andauthored
remove option to pass fill as str (#5632)
Co-authored-by: Vasilis Vryniotis <datumbox@users.noreply.github.com>
1 parent 585b3b1 commit 39772ec

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

torchvision/transforms/functional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,11 @@ def pad(img: Tensor, padding: List[int], fill: int = 0, padding_mode: str = "con
448448
.. note::
449449
In torchscript mode padding as single int is not supported, use a sequence of
450450
length 1: ``[padding, ]``.
451-
fill (number or str or tuple): Pixel fill value for constant fill. Default is 0.
451+
fill (number or tuple): Pixel fill value for constant fill. Default is 0.
452452
If a tuple of length 3, it is used to fill R, G, B channels respectively.
453453
This value is only used when the padding_mode is constant.
454454
Only number is supported for torch Tensor.
455-
Only int or str or tuple value is supported for PIL Image.
455+
Only int or tuple value is supported for PIL Image.
456456
padding_mode (str): Type of padding. Should be: constant, edge, reflect or symmetric.
457457
Default is constant.
458458

torchvision/transforms/functional_pil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def pad(
154154

155155
if not isinstance(padding, (numbers.Number, tuple, list)):
156156
raise TypeError("Got inappropriate padding arg")
157-
if not isinstance(fill, (numbers.Number, str, tuple, list)):
157+
if not isinstance(fill, (numbers.Number, tuple, list)):
158158
raise TypeError("Got inappropriate fill arg")
159159
if not isinstance(padding_mode, str):
160160
raise TypeError("Got inappropriate padding_mode arg")

torchvision/transforms/transforms.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,11 @@ class Pad(torch.nn.Module):
400400
.. note::
401401
In torchscript mode padding as single int is not supported, use a sequence of
402402
length 1: ``[padding, ]``.
403-
fill (number or str or tuple): Pixel fill value for constant fill. Default is 0. If a tuple of
403+
fill (number or tuple): Pixel fill value for constant fill. Default is 0. If a tuple of
404404
length 3, it is used to fill R, G, B channels respectively.
405405
This value is only used when the padding_mode is constant.
406406
Only number is supported for torch Tensor.
407-
Only int or str or tuple value is supported for PIL Image.
407+
Only int or tuple value is supported for PIL Image.
408408
padding_mode (str): Type of padding. Should be: constant, edge, reflect or symmetric.
409409
Default is constant.
410410
@@ -428,7 +428,7 @@ def __init__(self, padding, fill=0, padding_mode="constant"):
428428
if not isinstance(padding, (numbers.Number, tuple, list)):
429429
raise TypeError("Got inappropriate padding arg")
430430

431-
if not isinstance(fill, (numbers.Number, str, tuple, list)):
431+
if not isinstance(fill, (numbers.Number, tuple, list)):
432432
raise TypeError("Got inappropriate fill arg")
433433

434434
if padding_mode not in ["constant", "edge", "reflect", "symmetric"]:
@@ -595,11 +595,11 @@ class RandomCrop(torch.nn.Module):
595595
pad_if_needed (boolean): It will pad the image if smaller than the
596596
desired size to avoid raising an exception. Since cropping is done
597597
after padding, the padding seems to be done at a random offset.
598-
fill (number or str or tuple): Pixel fill value for constant fill. Default is 0. If a tuple of
598+
fill (number or tuple): Pixel fill value for constant fill. Default is 0. If a tuple of
599599
length 3, it is used to fill R, G, B channels respectively.
600600
This value is only used when the padding_mode is constant.
601601
Only number is supported for torch Tensor.
602-
Only int or str or tuple value is supported for PIL Image.
602+
Only int or tuple value is supported for PIL Image.
603603
padding_mode (str): Type of padding. Should be: constant, edge, reflect or symmetric.
604604
Default is constant.
605605

0 commit comments

Comments
 (0)