Skip to content

Commit 65d7a85

Browse files
committed
RandomAffine and RandomPerspective
1 parent b8f6edf commit 65d7a85

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

torchvision/transforms/transforms.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,9 @@ def forward(self, img):
705705

706706
fill = self.fill
707707
if isinstance(img, Tensor):
708-
if isinstance(fill, (int, float)):
708+
if fill is None:
709+
fill = [.0] * F._get_image_num_channels(img)
710+
elif isinstance(fill, (int, float)):
709711
fill = [float(fill)] * F._get_image_num_channels(img)
710712
else:
711713
fill = [float(f) for f in fill]
@@ -1390,7 +1392,9 @@ def forward(self, img):
13901392
"""
13911393
fill = self.fill
13921394
if isinstance(img, Tensor):
1393-
if isinstance(fill, (int, float)):
1395+
if fill is None:
1396+
fill = [.0] * F._get_image_num_channels(img)
1397+
elif isinstance(fill, (int, float)):
13941398
fill = [float(fill)] * F._get_image_num_channels(img)
13951399
else:
13961400
fill = [float(f) for f in fill]

0 commit comments

Comments
 (0)