@@ -164,10 +164,10 @@ def _dtypes(self, kind):
164
164
int16 = torch .int16
165
165
int32 = torch .int32
166
166
int64 = torch .int64
167
- uint8 = getattr ( torch , " uint8" , None )
168
- uint16 = getattr ( torch , "uint16" , None )
169
- uint32 = getattr ( torch , "uint32" , None )
170
- uint64 = getattr ( torch , "uint64" , None )
167
+ uint8 = torch . uint8
168
+ # uint16, uint32, and uint64 are present in newer versions of pytorch,
169
+ # but they aren't generally supported by the array API functions, so
170
+ # we omit them from this function.
171
171
float32 = torch .float32
172
172
float64 = torch .float64
173
173
complex64 = torch .complex64
@@ -181,9 +181,6 @@ def _dtypes(self, kind):
181
181
"int32" : int32 ,
182
182
"int64" : int64 ,
183
183
"uint8" : uint8 ,
184
- "uint16" : uint16 ,
185
- "uint32" : uint32 ,
186
- "uint64" : uint64 ,
187
184
"float32" : float32 ,
188
185
"float64" : float64 ,
189
186
"complex64" : complex64 ,
@@ -201,9 +198,6 @@ def _dtypes(self, kind):
201
198
if kind == "unsigned integer" :
202
199
return {
203
200
"uint8" : uint8 ,
204
- "uint16" : uint16 ,
205
- "uint32" : uint32 ,
206
- "uint64" : uint64 ,
207
201
}
208
202
if kind == "integral" :
209
203
return {
@@ -212,9 +206,6 @@ def _dtypes(self, kind):
212
206
"int32" : int32 ,
213
207
"int64" : int64 ,
214
208
"uint8" : uint8 ,
215
- "uint16" : uint16 ,
216
- "uint32" : uint32 ,
217
- "uint64" : uint64 ,
218
209
}
219
210
if kind == "real floating" :
220
211
return {
@@ -233,9 +224,6 @@ def _dtypes(self, kind):
233
224
"int32" : int32 ,
234
225
"int64" : int64 ,
235
226
"uint8" : uint8 ,
236
- "uint16" : uint16 ,
237
- "uint32" : uint32 ,
238
- "uint64" : uint64 ,
239
227
"float32" : float32 ,
240
228
"float64" : float64 ,
241
229
"complex64" : complex64 ,
@@ -305,9 +293,6 @@ def dtypes(self, *, device=None, kind=None):
305
293
"""
306
294
res = self ._dtypes (kind )
307
295
for k , v in res .copy ().items ():
308
- if v is None :
309
- del res [k ]
310
- continue
311
296
try :
312
297
torch .empty ((0 ,), dtype = v , device = device )
313
298
except :
0 commit comments