@@ -16,7 +16,7 @@ def __new__(
1616 device : Optional [Union [torch .device , str , int ]] = None ,
1717 requires_grad : bool = False ,
1818 ) -> F :
19- feature = cast (
19+ return cast (
2020 F ,
2121 torch .Tensor ._make_subclass (
2222 cast (_TensorBase , cls ),
@@ -25,13 +25,6 @@ def __new__(
2525 ),
2626 )
2727
28- # To avoid circular dependency between features and transforms
29- # This does not work with dataloader multi-worker setup
30- # from torchvision.prototype.transforms import functional
31- # setattr(feature, "_F", functional) # type: ignore[attr-defined]
32-
33- return feature
34-
3528 @classmethod
3629 def new_like (
3730 cls : Type [F ],
@@ -92,34 +85,26 @@ def __torch_function__(
9285 return output
9386
9487 def horizontal_flip (self ) -> Any :
95- # Just output itself
96- # How dangerous to do this instead of raising an error ?
9788 return self
9889
9990 def vertical_flip (self ) -> Any :
100- # Just output itself
101- # How dangerous to do this instead of raising an error ?
10291 return self
10392
93+ # TODO: We have to ignore override mypy error as there is torch.Tensor built-in deprecated op: Tensor.resize
94+ # https://github.com/pytorch/pytorch/blob/e8727994eb7cdb2ab642749d6549bc497563aa06/torch/_tensor.py#L588-L593
10495 def resize ( # type: ignore[override]
10596 self ,
10697 size : List [int ],
10798 interpolation : InterpolationMode = InterpolationMode .BILINEAR ,
10899 max_size : Optional [int ] = None ,
109100 antialias : bool = False ,
110101 ) -> Any :
111- # Just output itself
112- # How dangerous to do this instead of raising an error ?
113102 return self
114103
115104 def crop (self , top : int , left : int , height : int , width : int ) -> Any :
116- # Just output itself
117- # How dangerous to do this instead of raising an error ?
118105 return self
119106
120107 def center_crop (self , output_size : List [int ]) -> Any :
121- # Just output itself
122- # How dangerous to do this instead of raising an error ?
123108 return self
124109
125110 def resized_crop (
@@ -132,13 +117,9 @@ def resized_crop(
132117 interpolation : InterpolationMode = InterpolationMode .BILINEAR ,
133118 antialias : bool = False ,
134119 ) -> Any :
135- # Just output itself
136- # How dangerous to do this instead of raising an error ?
137120 return self
138121
139122 def pad (self , padding : List [int ], fill : Union [float , Sequence [float ]] = 0 , padding_mode : str = "constant" ) -> Any :
140- # Just output itself
141- # How dangerous to do this instead of raising an error ?
142123 return self
143124
144125 def rotate (
@@ -149,8 +130,6 @@ def rotate(
149130 fill : Optional [List [float ]] = None ,
150131 center : Optional [List [float ]] = None ,
151132 ) -> Any :
152- # Just output itself
153- # How dangerous to do this instead of raising an error ?
154133 return self
155134
156135 def affine (
@@ -163,8 +142,6 @@ def affine(
163142 fill : Optional [List [float ]] = None ,
164143 center : Optional [List [float ]] = None ,
165144 ) -> Any :
166- # Just output itself
167- # How dangerous to do this instead of raising an error ?
168145 return self
169146
170147 def perspective (
@@ -173,76 +150,46 @@ def perspective(
173150 interpolation : InterpolationMode = InterpolationMode .BILINEAR ,
174151 fill : Optional [List [float ]] = None ,
175152 ) -> Any :
176- # Just output itself
177- # How dangerous to do this instead of raising an error ?
178153 return self
179154
180155 def adjust_brightness (self , brightness_factor : float ) -> Any :
181- # Just output itself
182- # How dangerous to do this instead of raising an error ?
183156 return self
184157
185158 def adjust_saturation (self , saturation_factor : float ) -> Any :
186- # Just output itself
187- # How dangerous to do this instead of raising an error ?
188159 return self
189160
190161 def adjust_contrast (self , contrast_factor : float ) -> Any :
191- # Just output itself
192- # How dangerous to do this instead of raising an error ?
193162 return self
194163
195164 def adjust_sharpness (self , sharpness_factor : float ) -> Any :
196- # Just output itself
197- # How dangerous to do this instead of raising an error ?
198165 return self
199166
200167 def adjust_hue (self , hue_factor : float ) -> Any :
201- # Just output itself
202- # How dangerous to do this instead of raising an error ?
203168 return self
204169
205170 def adjust_gamma (self , gamma : float , gain : float = 1 ) -> Any :
206- # Just output itself
207- # How dangerous to do this instead of raising an error ?
208171 return self
209172
210173 def posterize (self , bits : int ) -> Any :
211- # Just output itself
212- # How dangerous to do this instead of raising an error ?
213174 return self
214175
215176 def solarize (self , threshold : float ) -> Any :
216- # Just output itself
217- # How dangerous to do this instead of raising an error ?
218177 return self
219178
220179 def autocontrast (self ) -> Any :
221- # Just output itself
222- # How dangerous to do this instead of raising an error ?
223180 return self
224181
225182 def equalize (self ) -> Any :
226- # Just output itself
227- # How dangerous to do this instead of raising an error ?
228183 return self
229184
230185 def invert (self ) -> Any :
231- # Just output itself
232- # How dangerous to do this instead of raising an error ?
233186 return self
234187
235188 def erase (self , i : int , j : int , h : int , w : int , v : torch .Tensor ) -> Any :
236- # Just output itself
237- # How dangerous to do this instead of raising an error ?
238189 return self
239190
240191 def mixup (self , lam : float ) -> Any :
241- # Just output itself
242- # How dangerous to do this instead of raising an error ?
243192 return self
244193
245194 def cutmix (self , box : Tuple [int , int , int , int ], lam_adjusted : float ) -> Any :
246- # Just output itself
247- # How dangerous to do this instead of raising an error ?
248195 return self
0 commit comments