Skip to content

Commit 56f4e00

Browse files
committed
better looking
1 parent f983fc3 commit 56f4e00

File tree

2 files changed

+27
-36
lines changed

2 files changed

+27
-36
lines changed

torchvision/transforms/functional.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -427,21 +427,18 @@ def pad(img: Tensor, padding: List[int], fill: int = 0, padding_mode: str = "con
427427
padding_mode (str): Type of padding. Should be: constant, edge, reflect or symmetric.
428428
Default is constant.
429429
430-
- constant: pads with a constant value, this value is specified with fill
430+
- constant: pads with a constant value, this value is specified with fill.
431431
432-
- edge: pads with the last value at the edge of the image
432+
- edge: pads with the last value at the edge of the image.
433+
If input a 5D torch Tensor, the last 3 dimensions will be padded instead of the last 2
433434
434-
If input a 5D torch Tensor, the last 3 dimensions will be padded instead of the last 2
435+
- reflect: pads with reflection of image without repeating the last value on the edge.
436+
For example, padding [1, 2, 3, 4] with 2 elements on both sides in reflect mode
437+
will result in [3, 2, 1, 2, 3, 4, 3, 2]
435438
436-
- reflect: pads with reflection of image without repeating the last value on the edge
437-
438-
For example, padding [1, 2, 3, 4] with 2 elements on both sides in reflect mode
439-
will result in [3, 2, 1, 2, 3, 4, 3, 2]
440-
441-
- symmetric: pads with reflection of image repeating the last value on the edge
442-
443-
For example, padding [1, 2, 3, 4] with 2 elements on both sides in symmetric mode
444-
will result in [2, 1, 1, 2, 3, 4, 4, 3]
439+
- symmetric: pads with reflection of image repeating the last value on the edge.
440+
For example, padding [1, 2, 3, 4] with 2 elements on both sides in symmetric mode
441+
will result in [2, 1, 1, 2, 3, 4, 4, 3]
445442
446443
Returns:
447444
PIL Image or Tensor: Padded image.

torchvision/transforms/transforms.py

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -359,21 +359,18 @@ class Pad(torch.nn.Module):
359359
padding_mode (str): Type of padding. Should be: constant, edge, reflect or symmetric.
360360
Default is constant.
361361
362-
- constant: pads with a constant value, this value is specified with fill
362+
- constant: pads with a constant value, this value is specified with fill.
363363
364-
- edge: pads with the last value at the edge of the image
364+
- edge: pads with the last value at the edge of the image.
365+
If input a 5D torch Tensor, the last 3 dimensions will be padded instead of the last 2
365366
366-
If input a 5D torch Tensor, the last 3 dimensions will be padded instead of the last 2
367+
- reflect: pads with reflection of image without repeating the last value on the edge.
368+
For example, padding [1, 2, 3, 4] with 2 elements on both sides in reflect mode
369+
will result in [3, 2, 1, 2, 3, 4, 3, 2]
367370
368-
- reflect: pads with reflection of image without repeating the last value on the edge
369-
370-
For example, padding [1, 2, 3, 4] with 2 elements on both sides in reflect mode
371-
will result in [3, 2, 1, 2, 3, 4, 3, 2]
372-
373-
- symmetric: pads with reflection of image repeating the last value on the edge
374-
375-
For example, padding [1, 2, 3, 4] with 2 elements on both sides in symmetric mode
376-
will result in [2, 1, 1, 2, 3, 4, 4, 3]
371+
- symmetric: pads with reflection of image repeating the last value on the edge.
372+
For example, padding [1, 2, 3, 4] with 2 elements on both sides in symmetric mode
373+
will result in [2, 1, 1, 2, 3, 4, 4, 3]
377374
"""
378375

379376
def __init__(self, padding, fill=0, padding_mode="constant"):
@@ -544,21 +541,18 @@ class RandomCrop(torch.nn.Module):
544541
padding_mode (str): Type of padding. Should be: constant, edge, reflect or symmetric.
545542
Default is constant.
546543
547-
- constant: pads with a constant value, this value is specified with fill
548-
549-
- edge: pads with the last value at the edge of the image
550-
551-
If input a 5D torch Tensor, the last 3 dimensions will be padded instead of the last 2
552-
553-
- reflect: pads with reflection of image without repeating the last value on the edge
544+
- constant: pads with a constant value, this value is specified with fill.
554545
555-
For example, padding [1, 2, 3, 4] with 2 elements on both sides in reflect mode
556-
will result in [3, 2, 1, 2, 3, 4, 3, 2]
546+
- edge: pads with the last value at the edge of the image.
547+
If input a 5D torch Tensor, the last 3 dimensions will be padded instead of the last 2
557548
558-
- symmetric: pads with reflection of image repeating the last value on the edge
549+
- reflect: pads with reflection of image without repeating the last value on the edge.
550+
For example, padding [1, 2, 3, 4] with 2 elements on both sides in reflect mode
551+
will result in [3, 2, 1, 2, 3, 4, 3, 2]
559552
560-
For example, padding [1, 2, 3, 4] with 2 elements on both sides in symmetric mode
561-
will result in [2, 1, 1, 2, 3, 4, 4, 3]
553+
- symmetric: pads with reflection of image repeating the last value on the edge.
554+
For example, padding [1, 2, 3, 4] with 2 elements on both sides in symmetric mode
555+
will result in [2, 1, 1, 2, 3, 4, 4, 3]
562556
"""
563557

564558
@staticmethod

0 commit comments

Comments
 (0)