Skip to content

Commit 402b01f

Browse files
committed
fix solarize in AA
1 parent 9acf2f4 commit 402b01f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

torchvision/prototype/transforms/_auto_augment.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from torchvision.prototype import features
99
from torchvision.prototype.transforms import AutoAugmentPolicy, functional as F, InterpolationMode, Transform
1010
from torchvision.prototype.transforms.functional._meta import get_spatial_size
11+
from torchvision.transforms import functional_tensor as _FT
1112

1213
from ._utils import _isinstance, _setup_fill_arg
1314

@@ -137,7 +138,7 @@ def _apply_image_or_video_transform(
137138
elif transform_id == "Posterize":
138139
return F.posterize(image, bits=int(magnitude))
139140
elif transform_id == "Solarize":
140-
bound = 1.0 if isinstance(image, torch.Tensor) and image.is_floating_point() else 255.0
141+
bound = _FT._max_value(image.dtype) if isinstance(image, torch.Tensor) else 255.0
141142
return F.solarize(image, threshold=bound * magnitude)
142143
elif transform_id == "AutoContrast":
143144
return F.autocontrast(image)

0 commit comments

Comments
 (0)