@@ -162,7 +162,10 @@ def __exit__(self, *args):
162
162
163
163
164
164
def fft (a , n = None , axis = - 1 , norm = None , overwrite_x = False , workers = None ):
165
- x = _float_utils .__upcast_float16_array (a )
165
+ try :
166
+ x = _float_utils .__upcast_float16_array (a )
167
+ except ValueError :
168
+ return NotImplemented
166
169
with Workers (workers ):
167
170
output = _pydfti .fft (x , n = n , axis = axis , overwrite_x = overwrite_x )
168
171
if _unitary (norm ):
@@ -171,7 +174,10 @@ def fft(a, n=None, axis=-1, norm=None, overwrite_x=False, workers=None):
171
174
172
175
173
176
def ifft (a , n = None , axis = - 1 , norm = None , overwrite_x = False , workers = None ):
174
- x = _float_utils .__upcast_float16_array (a )
177
+ try :
178
+ x = _float_utils .__upcast_float16_array (a )
179
+ except ValueError :
180
+ return NotImplemented
175
181
with Workers (workers ):
176
182
output = _pydfti .ifft (x , n = n , axis = axis , overwrite_x = overwrite_x )
177
183
if _unitary (norm ):
@@ -180,7 +186,10 @@ def ifft(a, n=None, axis=-1, norm=None, overwrite_x=False, workers=None):
180
186
181
187
182
188
def fft2 (a , s = None , axes = (- 2 ,- 1 ), norm = None , overwrite_x = False , workers = None ):
183
- x = _float_utils .__upcast_float16_array (a )
189
+ try :
190
+ x = _float_utils .__upcast_float16_array (a )
191
+ except ValueError :
192
+ return NotImplemented
184
193
with Workers (workers ):
185
194
output = _pydfti .fftn (x , shape = s , axes = axes , overwrite_x = overwrite_x )
186
195
if _unitary (norm ):
@@ -192,7 +201,10 @@ def fft2(a, s=None, axes=(-2,-1), norm=None, overwrite_x=False, workers=None):
192
201
193
202
194
203
def ifft2 (a , s = None , axes = (- 2 ,- 1 ), norm = None , overwrite_x = False , workers = None ):
195
- x = _float_utils .__upcast_float16_array (a )
204
+ try :
205
+ x = _float_utils .__upcast_float16_array (a )
206
+ except ValueError :
207
+ return NotImplemented
196
208
with Workers (workers ):
197
209
output = _pydfti .ifftn (x , shape = s , axes = axes , overwrite_x = overwrite_x )
198
210
if _unitary (norm ):
@@ -205,7 +217,10 @@ def ifft2(a, s=None, axes=(-2,-1), norm=None, overwrite_x=False, workers=None):
205
217
206
218
207
219
def fftn (a , s = None , axes = None , norm = None , overwrite_x = False , workers = None ):
208
- x = _float_utils .__upcast_float16_array (a )
220
+ try :
221
+ x = _float_utils .__upcast_float16_array (a )
222
+ except ValueError :
223
+ return NotImplemented
209
224
with Workers (workers ):
210
225
output = _pydfti .fftn (x , shape = s , axes = axes , overwrite_x = overwrite_x )
211
226
if _unitary (norm ):
@@ -218,7 +233,10 @@ def fftn(a, s=None, axes=None, norm=None, overwrite_x=False, workers=None):
218
233
219
234
220
235
def ifftn (a , s = None , axes = None , norm = None , overwrite_x = False , workers = None ):
221
- x = _float_utils .__upcast_float16_array (a )
236
+ try :
237
+ x = _float_utils .__upcast_float16_array (a )
238
+ except ValueError :
239
+ return NotImplemented
222
240
with Workers (workers ):
223
241
output = _pydfti .ifftn (x , shape = s , axes = axes , overwrite_x = overwrite_x )
224
242
if _unitary (norm ):
@@ -231,7 +249,10 @@ def ifftn(a, s=None, axes=None, norm=None, overwrite_x=False, workers=None):
231
249
232
250
233
251
def rfft (a , n = None , axis = - 1 , norm = None , workers = None ):
234
- x = _float_utils .__upcast_float16_array (a )
252
+ try :
253
+ x = _float_utils .__upcast_float16_array (a )
254
+ except ValueError :
255
+ return NotImplemented
235
256
unitary = _unitary (norm )
236
257
x = _float_utils .__downcast_float128_array (x )
237
258
if unitary and n is None :
@@ -245,8 +266,10 @@ def rfft(a, n=None, axis=-1, norm=None, workers=None):
245
266
246
267
247
268
def irfft (a , n = None , axis = - 1 , norm = None , workers = None ):
248
- x = _float_utils .__upcast_float16_array (a )
249
- x = _float_utils .__downcast_float128_array (x )
269
+ try :
270
+ x = _float_utils .__upcast_float16_array (a )
271
+ except ValueError :
272
+ return NotImplemented
250
273
with Workers (workers ):
251
274
output = _pydfti .irfft_numpy (x , n = n , axis = axis )
252
275
if _unitary (norm ):
@@ -255,21 +278,27 @@ def irfft(a, n=None, axis=-1, norm=None, workers=None):
255
278
256
279
257
280
def rfft2 (a , s = None , axes = (- 2 , - 1 ), norm = None , workers = None ):
258
- x = _float_utils .__upcast_float16_array (a )
259
- x = _float_utils .__downcast_float128_array (a )
281
+ try :
282
+ x = _float_utils .__upcast_float16_array (a )
283
+ except ValueError :
284
+ return NotImplemented
260
285
return rfftn (x , s , axes , norm , workers )
261
286
262
287
263
288
def irfft2 (a , s = None , axes = (- 2 , - 1 ), norm = None , workers = None ):
264
- x = _float_utils .__upcast_float16_array (a )
265
- x = _float_utils .__downcast_float128_array (x )
289
+ try :
290
+ x = _float_utils .__upcast_float16_array (a )
291
+ except ValueError :
292
+ return NotImplemented
266
293
return irfftn (x , s , axes , norm , workers )
267
294
268
295
269
296
def rfftn (a , s = None , axes = None , norm = None , workers = None ):
270
297
unitary = _unitary (norm )
271
- x = _float_utils .__upcast_float16_array (a )
272
- x = _float_utils .__downcast_float128_array (x )
298
+ try :
299
+ x = _float_utils .__upcast_float16_array (a )
300
+ except ValueError :
301
+ return NotImplemented
273
302
if unitary :
274
303
x = asarray (x )
275
304
s , axes = _cook_nd_args (x , s , axes )
@@ -282,8 +311,10 @@ def rfftn(a, s=None, axes=None, norm=None, workers=None):
282
311
283
312
284
313
def irfftn (a , s = None , axes = None , norm = None , workers = None ):
285
- x = _float_utils .__upcast_float16_array (a )
286
- x = _float_utils .__downcast_float128_array (x )
314
+ try :
315
+ x = _float_utils .__upcast_float16_array (a )
316
+ except ValueError :
317
+ return NotImplemented
287
318
with Workers (workers ):
288
319
output = _pydfti .irfftn_numpy (x , s , axes )
289
320
if _unitary (norm ):
0 commit comments