1
1
import math
2
2
import numbers
3
3
import warnings
4
- from typing import Any , Callable , Dict , List , Optional , Sequence , Tuple , Union
4
+ from typing import Any , Callable , Dict , List , Optional , Sequence , Union
5
5
6
6
import PIL .Image
7
7
import torch
@@ -56,8 +56,8 @@ def _extract_params_for_v1_transform(self) -> Dict[str, Any]:
56
56
def __init__ (
57
57
self ,
58
58
p : float = 0.5 ,
59
- scale : Tuple [ float , float ] = (0.02 , 0.33 ),
60
- ratio : Tuple [ float , float ] = (0.3 , 3.3 ),
59
+ scale : Sequence [ float ] = (0.02 , 0.33 ),
60
+ ratio : Sequence [ float ] = (0.3 , 3.3 ),
61
61
value : float = 0.0 ,
62
62
inplace : bool = False ,
63
63
):
@@ -66,9 +66,9 @@ def __init__(
66
66
raise TypeError ("Argument value should be either a number or str or a sequence" )
67
67
if isinstance (value , str ) and value != "random" :
68
68
raise ValueError ("If value is str, it should be 'random'" )
69
- if not isinstance (scale , ( tuple , list ) ):
69
+ if not isinstance (scale , Sequence ):
70
70
raise TypeError ("Scale should be a sequence" )
71
- if not isinstance (ratio , ( tuple , list ) ):
71
+ if not isinstance (ratio , Sequence ):
72
72
raise TypeError ("Ratio should be a sequence" )
73
73
if (scale [0 ] > scale [1 ]) or (ratio [0 ] > ratio [1 ]):
74
74
warnings .warn ("Scale and ratio should be of kind (min, max)" )
0 commit comments