Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/gen_spectral_ops.py: 13%
782 statements
« prev ^ index » next coverage.py v7.4.0, created at 2024-01-03 07:57 +0000
« prev ^ index » next coverage.py v7.4.0, created at 2024-01-03 07:57 +0000
1"""Python wrappers around TensorFlow ops.
3This file is MACHINE GENERATED! Do not edit.
4"""
6import collections
8from tensorflow.python import pywrap_tfe as pywrap_tfe
9from tensorflow.python.eager import context as _context
10from tensorflow.python.eager import core as _core
11from tensorflow.python.eager import execute as _execute
12from tensorflow.python.framework import dtypes as _dtypes
13from tensorflow.security.fuzzing.py import annotation_types as _atypes
15from tensorflow.python.framework import op_def_registry as _op_def_registry
16from tensorflow.python.framework import ops as _ops
17from tensorflow.python.framework import op_def_library as _op_def_library
18from tensorflow.python.util.deprecation import deprecated_endpoints
19from tensorflow.python.util import dispatch as _dispatch
20from tensorflow.python.util.tf_export import tf_export
22from typing import TypeVar
24def batch_fft(input, name=None):
25 r"""TODO: add doc.
27 Args:
28 input: A `Tensor` of type `complex64`.
29 name: A name for the operation (optional).
31 Returns:
32 A `Tensor` of type `complex64`.
33 """
34 _ctx = _context._context or _context.context()
35 tld = _ctx._thread_local_data
36 if tld.is_eager:
37 try:
38 _result = pywrap_tfe.TFE_Py_FastPathExecute(
39 _ctx, "BatchFFT", name, input)
40 return _result
41 except _core._NotOkStatusException as e:
42 _ops.raise_from_not_ok_status(e, name)
43 except _core._FallbackException:
44 pass
45 try:
46 return batch_fft_eager_fallback(
47 input, name=name, ctx=_ctx)
48 except _core._SymbolicException:
49 pass # Add nodes to the TensorFlow graph.
50 # Add nodes to the TensorFlow graph.
51 _, _, _op, _outputs = _op_def_library._apply_op_helper(
52 "BatchFFT", input=input, name=name)
53 _result = _outputs[:]
54 if _execute.must_record_gradient():
55 _attrs = ()
56 _inputs_flat = _op.inputs
57 _execute.record_gradient(
58 "BatchFFT", _inputs_flat, _attrs, _result)
59 _result, = _result
60 return _result
62BatchFFT = tf_export("raw_ops.BatchFFT")(_ops.to_raw_op(batch_fft))
65def batch_fft_eager_fallback(input, name, ctx):
66 input = _ops.convert_to_tensor(input, _dtypes.complex64)
67 _inputs_flat = [input]
68 _attrs = None
69 _result = _execute.execute(b"BatchFFT", 1, inputs=_inputs_flat,
70 attrs=_attrs, ctx=ctx, name=name)
71 if _execute.must_record_gradient():
72 _execute.record_gradient(
73 "BatchFFT", _inputs_flat, _attrs, _result)
74 _result, = _result
75 return _result
78def batch_fft2d(input, name=None):
79 r"""TODO: add doc.
81 Args:
82 input: A `Tensor` of type `complex64`.
83 name: A name for the operation (optional).
85 Returns:
86 A `Tensor` of type `complex64`.
87 """
88 _ctx = _context._context or _context.context()
89 tld = _ctx._thread_local_data
90 if tld.is_eager:
91 try:
92 _result = pywrap_tfe.TFE_Py_FastPathExecute(
93 _ctx, "BatchFFT2D", name, input)
94 return _result
95 except _core._NotOkStatusException as e:
96 _ops.raise_from_not_ok_status(e, name)
97 except _core._FallbackException:
98 pass
99 try:
100 return batch_fft2d_eager_fallback(
101 input, name=name, ctx=_ctx)
102 except _core._SymbolicException:
103 pass # Add nodes to the TensorFlow graph.
104 # Add nodes to the TensorFlow graph.
105 _, _, _op, _outputs = _op_def_library._apply_op_helper(
106 "BatchFFT2D", input=input, name=name)
107 _result = _outputs[:]
108 if _execute.must_record_gradient():
109 _attrs = ()
110 _inputs_flat = _op.inputs
111 _execute.record_gradient(
112 "BatchFFT2D", _inputs_flat, _attrs, _result)
113 _result, = _result
114 return _result
116BatchFFT2D = tf_export("raw_ops.BatchFFT2D")(_ops.to_raw_op(batch_fft2d))
119def batch_fft2d_eager_fallback(input, name, ctx):
120 input = _ops.convert_to_tensor(input, _dtypes.complex64)
121 _inputs_flat = [input]
122 _attrs = None
123 _result = _execute.execute(b"BatchFFT2D", 1, inputs=_inputs_flat,
124 attrs=_attrs, ctx=ctx, name=name)
125 if _execute.must_record_gradient():
126 _execute.record_gradient(
127 "BatchFFT2D", _inputs_flat, _attrs, _result)
128 _result, = _result
129 return _result
132def batch_fft3d(input, name=None):
133 r"""TODO: add doc.
135 Args:
136 input: A `Tensor` of type `complex64`.
137 name: A name for the operation (optional).
139 Returns:
140 A `Tensor` of type `complex64`.
141 """
142 _ctx = _context._context or _context.context()
143 tld = _ctx._thread_local_data
144 if tld.is_eager:
145 try:
146 _result = pywrap_tfe.TFE_Py_FastPathExecute(
147 _ctx, "BatchFFT3D", name, input)
148 return _result
149 except _core._NotOkStatusException as e:
150 _ops.raise_from_not_ok_status(e, name)
151 except _core._FallbackException:
152 pass
153 try:
154 return batch_fft3d_eager_fallback(
155 input, name=name, ctx=_ctx)
156 except _core._SymbolicException:
157 pass # Add nodes to the TensorFlow graph.
158 # Add nodes to the TensorFlow graph.
159 _, _, _op, _outputs = _op_def_library._apply_op_helper(
160 "BatchFFT3D", input=input, name=name)
161 _result = _outputs[:]
162 if _execute.must_record_gradient():
163 _attrs = ()
164 _inputs_flat = _op.inputs
165 _execute.record_gradient(
166 "BatchFFT3D", _inputs_flat, _attrs, _result)
167 _result, = _result
168 return _result
170BatchFFT3D = tf_export("raw_ops.BatchFFT3D")(_ops.to_raw_op(batch_fft3d))
173def batch_fft3d_eager_fallback(input, name, ctx):
174 input = _ops.convert_to_tensor(input, _dtypes.complex64)
175 _inputs_flat = [input]
176 _attrs = None
177 _result = _execute.execute(b"BatchFFT3D", 1, inputs=_inputs_flat,
178 attrs=_attrs, ctx=ctx, name=name)
179 if _execute.must_record_gradient():
180 _execute.record_gradient(
181 "BatchFFT3D", _inputs_flat, _attrs, _result)
182 _result, = _result
183 return _result
186def batch_ifft(input, name=None):
187 r"""TODO: add doc.
189 Args:
190 input: A `Tensor` of type `complex64`.
191 name: A name for the operation (optional).
193 Returns:
194 A `Tensor` of type `complex64`.
195 """
196 _ctx = _context._context or _context.context()
197 tld = _ctx._thread_local_data
198 if tld.is_eager:
199 try:
200 _result = pywrap_tfe.TFE_Py_FastPathExecute(
201 _ctx, "BatchIFFT", name, input)
202 return _result
203 except _core._NotOkStatusException as e:
204 _ops.raise_from_not_ok_status(e, name)
205 except _core._FallbackException:
206 pass
207 try:
208 return batch_ifft_eager_fallback(
209 input, name=name, ctx=_ctx)
210 except _core._SymbolicException:
211 pass # Add nodes to the TensorFlow graph.
212 # Add nodes to the TensorFlow graph.
213 _, _, _op, _outputs = _op_def_library._apply_op_helper(
214 "BatchIFFT", input=input, name=name)
215 _result = _outputs[:]
216 if _execute.must_record_gradient():
217 _attrs = ()
218 _inputs_flat = _op.inputs
219 _execute.record_gradient(
220 "BatchIFFT", _inputs_flat, _attrs, _result)
221 _result, = _result
222 return _result
224BatchIFFT = tf_export("raw_ops.BatchIFFT")(_ops.to_raw_op(batch_ifft))
227def batch_ifft_eager_fallback(input, name, ctx):
228 input = _ops.convert_to_tensor(input, _dtypes.complex64)
229 _inputs_flat = [input]
230 _attrs = None
231 _result = _execute.execute(b"BatchIFFT", 1, inputs=_inputs_flat,
232 attrs=_attrs, ctx=ctx, name=name)
233 if _execute.must_record_gradient():
234 _execute.record_gradient(
235 "BatchIFFT", _inputs_flat, _attrs, _result)
236 _result, = _result
237 return _result
240def batch_ifft2d(input, name=None):
241 r"""TODO: add doc.
243 Args:
244 input: A `Tensor` of type `complex64`.
245 name: A name for the operation (optional).
247 Returns:
248 A `Tensor` of type `complex64`.
249 """
250 _ctx = _context._context or _context.context()
251 tld = _ctx._thread_local_data
252 if tld.is_eager:
253 try:
254 _result = pywrap_tfe.TFE_Py_FastPathExecute(
255 _ctx, "BatchIFFT2D", name, input)
256 return _result
257 except _core._NotOkStatusException as e:
258 _ops.raise_from_not_ok_status(e, name)
259 except _core._FallbackException:
260 pass
261 try:
262 return batch_ifft2d_eager_fallback(
263 input, name=name, ctx=_ctx)
264 except _core._SymbolicException:
265 pass # Add nodes to the TensorFlow graph.
266 # Add nodes to the TensorFlow graph.
267 _, _, _op, _outputs = _op_def_library._apply_op_helper(
268 "BatchIFFT2D", input=input, name=name)
269 _result = _outputs[:]
270 if _execute.must_record_gradient():
271 _attrs = ()
272 _inputs_flat = _op.inputs
273 _execute.record_gradient(
274 "BatchIFFT2D", _inputs_flat, _attrs, _result)
275 _result, = _result
276 return _result
278BatchIFFT2D = tf_export("raw_ops.BatchIFFT2D")(_ops.to_raw_op(batch_ifft2d))
281def batch_ifft2d_eager_fallback(input, name, ctx):
282 input = _ops.convert_to_tensor(input, _dtypes.complex64)
283 _inputs_flat = [input]
284 _attrs = None
285 _result = _execute.execute(b"BatchIFFT2D", 1, inputs=_inputs_flat,
286 attrs=_attrs, ctx=ctx, name=name)
287 if _execute.must_record_gradient():
288 _execute.record_gradient(
289 "BatchIFFT2D", _inputs_flat, _attrs, _result)
290 _result, = _result
291 return _result
294def batch_ifft3d(input, name=None):
295 r"""TODO: add doc.
297 Args:
298 input: A `Tensor` of type `complex64`.
299 name: A name for the operation (optional).
301 Returns:
302 A `Tensor` of type `complex64`.
303 """
304 _ctx = _context._context or _context.context()
305 tld = _ctx._thread_local_data
306 if tld.is_eager:
307 try:
308 _result = pywrap_tfe.TFE_Py_FastPathExecute(
309 _ctx, "BatchIFFT3D", name, input)
310 return _result
311 except _core._NotOkStatusException as e:
312 _ops.raise_from_not_ok_status(e, name)
313 except _core._FallbackException:
314 pass
315 try:
316 return batch_ifft3d_eager_fallback(
317 input, name=name, ctx=_ctx)
318 except _core._SymbolicException:
319 pass # Add nodes to the TensorFlow graph.
320 # Add nodes to the TensorFlow graph.
321 _, _, _op, _outputs = _op_def_library._apply_op_helper(
322 "BatchIFFT3D", input=input, name=name)
323 _result = _outputs[:]
324 if _execute.must_record_gradient():
325 _attrs = ()
326 _inputs_flat = _op.inputs
327 _execute.record_gradient(
328 "BatchIFFT3D", _inputs_flat, _attrs, _result)
329 _result, = _result
330 return _result
332BatchIFFT3D = tf_export("raw_ops.BatchIFFT3D")(_ops.to_raw_op(batch_ifft3d))
335def batch_ifft3d_eager_fallback(input, name, ctx):
336 input = _ops.convert_to_tensor(input, _dtypes.complex64)
337 _inputs_flat = [input]
338 _attrs = None
339 _result = _execute.execute(b"BatchIFFT3D", 1, inputs=_inputs_flat,
340 attrs=_attrs, ctx=ctx, name=name)
341 if _execute.must_record_gradient():
342 _execute.record_gradient(
343 "BatchIFFT3D", _inputs_flat, _attrs, _result)
344 _result, = _result
345 return _result
348@_dispatch.add_fallback_dispatch_list
349@_dispatch.add_type_based_api_dispatcher
350@tf_export('signal.fft', v1=['signal.fft', 'spectral.fft', 'fft'])
351@deprecated_endpoints('spectral.fft', 'fft')
352def fft(input, name=None):
353 r"""Fast Fourier transform.
355 Computes the 1-dimensional discrete Fourier transform over the inner-most
356 dimension of `input`.
358 Args:
359 input: A `Tensor`. Must be one of the following types: `complex64`, `complex128`.
360 A complex tensor.
361 name: A name for the operation (optional).
363 Returns:
364 A `Tensor`. Has the same type as `input`.
365 """
366 _ctx = _context._context or _context.context()
367 tld = _ctx._thread_local_data
368 if tld.is_eager:
369 try:
370 _result = pywrap_tfe.TFE_Py_FastPathExecute(
371 _ctx, "FFT", name, input)
372 return _result
373 except _core._NotOkStatusException as e:
374 _ops.raise_from_not_ok_status(e, name)
375 except _core._FallbackException:
376 pass
377 try:
378 _result = _dispatcher_for_fft(
379 (input, name,), None)
380 if _result is not NotImplemented:
381 return _result
382 return fft_eager_fallback(
383 input, name=name, ctx=_ctx)
384 except _core._SymbolicException:
385 pass # Add nodes to the TensorFlow graph.
386 except (TypeError, ValueError):
387 _result = _dispatch.dispatch(
388 fft, (), dict(input=input, name=name)
389 )
390 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED:
391 return _result
392 raise
393 else:
394 _result = _dispatcher_for_fft(
395 (input, name,), None)
396 if _result is not NotImplemented:
397 return _result
398 # Add nodes to the TensorFlow graph.
399 try:
400 _, _, _op, _outputs = _op_def_library._apply_op_helper(
401 "FFT", input=input, name=name)
402 except (TypeError, ValueError):
403 _result = _dispatch.dispatch(
404 fft, (), dict(input=input, name=name)
405 )
406 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED:
407 return _result
408 raise
409 _result = _outputs[:]
410 if _execute.must_record_gradient():
411 _attrs = ("Tcomplex", _op._get_attr_type("Tcomplex"))
412 _inputs_flat = _op.inputs
413 _execute.record_gradient(
414 "FFT", _inputs_flat, _attrs, _result)
415 _result, = _result
416 return _result
418FFT = tf_export("raw_ops.FFT")(_ops.to_raw_op(fft))
419_dispatcher_for_fft = fft._tf_type_based_dispatcher.Dispatch
422def fft_eager_fallback(input, name, ctx):
423 _attr_Tcomplex, (input,) = _execute.args_to_matching_eager([input], ctx, [_dtypes.complex64, _dtypes.complex128, ], _dtypes.complex64)
424 _inputs_flat = [input]
425 _attrs = ("Tcomplex", _attr_Tcomplex)
426 _result = _execute.execute(b"FFT", 1, inputs=_inputs_flat, attrs=_attrs,
427 ctx=ctx, name=name)
428 if _execute.must_record_gradient():
429 _execute.record_gradient(
430 "FFT", _inputs_flat, _attrs, _result)
431 _result, = _result
432 return _result
435@_dispatch.add_fallback_dispatch_list
436@_dispatch.add_type_based_api_dispatcher
437@tf_export('signal.fft2d', v1=['signal.fft2d', 'spectral.fft2d', 'fft2d'])
438@deprecated_endpoints('spectral.fft2d', 'fft2d')
439def fft2d(input, name=None):
440 r"""2D fast Fourier transform.
442 Computes the 2-dimensional discrete Fourier transform over the inner-most
443 2 dimensions of `input`.
445 Args:
446 input: A `Tensor`. Must be one of the following types: `complex64`, `complex128`.
447 A complex tensor.
448 name: A name for the operation (optional).
450 Returns:
451 A `Tensor`. Has the same type as `input`.
452 """
453 _ctx = _context._context or _context.context()
454 tld = _ctx._thread_local_data
455 if tld.is_eager:
456 try:
457 _result = pywrap_tfe.TFE_Py_FastPathExecute(
458 _ctx, "FFT2D", name, input)
459 return _result
460 except _core._NotOkStatusException as e:
461 _ops.raise_from_not_ok_status(e, name)
462 except _core._FallbackException:
463 pass
464 try:
465 _result = _dispatcher_for_fft2d(
466 (input, name,), None)
467 if _result is not NotImplemented:
468 return _result
469 return fft2d_eager_fallback(
470 input, name=name, ctx=_ctx)
471 except _core._SymbolicException:
472 pass # Add nodes to the TensorFlow graph.
473 except (TypeError, ValueError):
474 _result = _dispatch.dispatch(
475 fft2d, (), dict(input=input, name=name)
476 )
477 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED:
478 return _result
479 raise
480 else:
481 _result = _dispatcher_for_fft2d(
482 (input, name,), None)
483 if _result is not NotImplemented:
484 return _result
485 # Add nodes to the TensorFlow graph.
486 try:
487 _, _, _op, _outputs = _op_def_library._apply_op_helper(
488 "FFT2D", input=input, name=name)
489 except (TypeError, ValueError):
490 _result = _dispatch.dispatch(
491 fft2d, (), dict(input=input, name=name)
492 )
493 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED:
494 return _result
495 raise
496 _result = _outputs[:]
497 if _execute.must_record_gradient():
498 _attrs = ("Tcomplex", _op._get_attr_type("Tcomplex"))
499 _inputs_flat = _op.inputs
500 _execute.record_gradient(
501 "FFT2D", _inputs_flat, _attrs, _result)
502 _result, = _result
503 return _result
505FFT2D = tf_export("raw_ops.FFT2D")(_ops.to_raw_op(fft2d))
506_dispatcher_for_fft2d = fft2d._tf_type_based_dispatcher.Dispatch
509def fft2d_eager_fallback(input, name, ctx):
510 _attr_Tcomplex, (input,) = _execute.args_to_matching_eager([input], ctx, [_dtypes.complex64, _dtypes.complex128, ], _dtypes.complex64)
511 _inputs_flat = [input]
512 _attrs = ("Tcomplex", _attr_Tcomplex)
513 _result = _execute.execute(b"FFT2D", 1, inputs=_inputs_flat, attrs=_attrs,
514 ctx=ctx, name=name)
515 if _execute.must_record_gradient():
516 _execute.record_gradient(
517 "FFT2D", _inputs_flat, _attrs, _result)
518 _result, = _result
519 return _result
522@_dispatch.add_fallback_dispatch_list
523@_dispatch.add_type_based_api_dispatcher
524@tf_export('signal.fft3d', v1=['signal.fft3d', 'spectral.fft3d', 'fft3d'])
525@deprecated_endpoints('spectral.fft3d', 'fft3d')
526def fft3d(input, name=None):
527 r"""3D fast Fourier transform.
529 Computes the 3-dimensional discrete Fourier transform over the inner-most 3
530 dimensions of `input`.
532 Args:
533 input: A `Tensor`. Must be one of the following types: `complex64`, `complex128`.
534 A complex tensor.
535 name: A name for the operation (optional).
537 Returns:
538 A `Tensor`. Has the same type as `input`.
539 """
540 _ctx = _context._context or _context.context()
541 tld = _ctx._thread_local_data
542 if tld.is_eager:
543 try:
544 _result = pywrap_tfe.TFE_Py_FastPathExecute(
545 _ctx, "FFT3D", name, input)
546 return _result
547 except _core._NotOkStatusException as e:
548 _ops.raise_from_not_ok_status(e, name)
549 except _core._FallbackException:
550 pass
551 try:
552 _result = _dispatcher_for_fft3d(
553 (input, name,), None)
554 if _result is not NotImplemented:
555 return _result
556 return fft3d_eager_fallback(
557 input, name=name, ctx=_ctx)
558 except _core._SymbolicException:
559 pass # Add nodes to the TensorFlow graph.
560 except (TypeError, ValueError):
561 _result = _dispatch.dispatch(
562 fft3d, (), dict(input=input, name=name)
563 )
564 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED:
565 return _result
566 raise
567 else:
568 _result = _dispatcher_for_fft3d(
569 (input, name,), None)
570 if _result is not NotImplemented:
571 return _result
572 # Add nodes to the TensorFlow graph.
573 try:
574 _, _, _op, _outputs = _op_def_library._apply_op_helper(
575 "FFT3D", input=input, name=name)
576 except (TypeError, ValueError):
577 _result = _dispatch.dispatch(
578 fft3d, (), dict(input=input, name=name)
579 )
580 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED:
581 return _result
582 raise
583 _result = _outputs[:]
584 if _execute.must_record_gradient():
585 _attrs = ("Tcomplex", _op._get_attr_type("Tcomplex"))
586 _inputs_flat = _op.inputs
587 _execute.record_gradient(
588 "FFT3D", _inputs_flat, _attrs, _result)
589 _result, = _result
590 return _result
592FFT3D = tf_export("raw_ops.FFT3D")(_ops.to_raw_op(fft3d))
593_dispatcher_for_fft3d = fft3d._tf_type_based_dispatcher.Dispatch
596def fft3d_eager_fallback(input, name, ctx):
597 _attr_Tcomplex, (input,) = _execute.args_to_matching_eager([input], ctx, [_dtypes.complex64, _dtypes.complex128, ], _dtypes.complex64)
598 _inputs_flat = [input]
599 _attrs = ("Tcomplex", _attr_Tcomplex)
600 _result = _execute.execute(b"FFT3D", 1, inputs=_inputs_flat, attrs=_attrs,
601 ctx=ctx, name=name)
602 if _execute.must_record_gradient():
603 _execute.record_gradient(
604 "FFT3D", _inputs_flat, _attrs, _result)
605 _result, = _result
606 return _result
609@_dispatch.add_fallback_dispatch_list
610@_dispatch.add_type_based_api_dispatcher
611@tf_export('signal.ifft', v1=['signal.ifft', 'spectral.ifft', 'ifft'])
612@deprecated_endpoints('spectral.ifft', 'ifft')
613def ifft(input, name=None):
614 r"""Inverse fast Fourier transform.
616 Computes the inverse 1-dimensional discrete Fourier transform over the
617 inner-most dimension of `input`.
619 Args:
620 input: A `Tensor`. Must be one of the following types: `complex64`, `complex128`.
621 A complex tensor.
622 name: A name for the operation (optional).
624 Returns:
625 A `Tensor`. Has the same type as `input`.
626 """
627 _ctx = _context._context or _context.context()
628 tld = _ctx._thread_local_data
629 if tld.is_eager:
630 try:
631 _result = pywrap_tfe.TFE_Py_FastPathExecute(
632 _ctx, "IFFT", name, input)
633 return _result
634 except _core._NotOkStatusException as e:
635 _ops.raise_from_not_ok_status(e, name)
636 except _core._FallbackException:
637 pass
638 try:
639 _result = _dispatcher_for_ifft(
640 (input, name,), None)
641 if _result is not NotImplemented:
642 return _result
643 return ifft_eager_fallback(
644 input, name=name, ctx=_ctx)
645 except _core._SymbolicException:
646 pass # Add nodes to the TensorFlow graph.
647 except (TypeError, ValueError):
648 _result = _dispatch.dispatch(
649 ifft, (), dict(input=input, name=name)
650 )
651 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED:
652 return _result
653 raise
654 else:
655 _result = _dispatcher_for_ifft(
656 (input, name,), None)
657 if _result is not NotImplemented:
658 return _result
659 # Add nodes to the TensorFlow graph.
660 try:
661 _, _, _op, _outputs = _op_def_library._apply_op_helper(
662 "IFFT", input=input, name=name)
663 except (TypeError, ValueError):
664 _result = _dispatch.dispatch(
665 ifft, (), dict(input=input, name=name)
666 )
667 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED:
668 return _result
669 raise
670 _result = _outputs[:]
671 if _execute.must_record_gradient():
672 _attrs = ("Tcomplex", _op._get_attr_type("Tcomplex"))
673 _inputs_flat = _op.inputs
674 _execute.record_gradient(
675 "IFFT", _inputs_flat, _attrs, _result)
676 _result, = _result
677 return _result
679IFFT = tf_export("raw_ops.IFFT")(_ops.to_raw_op(ifft))
680_dispatcher_for_ifft = ifft._tf_type_based_dispatcher.Dispatch
683def ifft_eager_fallback(input, name, ctx):
684 _attr_Tcomplex, (input,) = _execute.args_to_matching_eager([input], ctx, [_dtypes.complex64, _dtypes.complex128, ], _dtypes.complex64)
685 _inputs_flat = [input]
686 _attrs = ("Tcomplex", _attr_Tcomplex)
687 _result = _execute.execute(b"IFFT", 1, inputs=_inputs_flat, attrs=_attrs,
688 ctx=ctx, name=name)
689 if _execute.must_record_gradient():
690 _execute.record_gradient(
691 "IFFT", _inputs_flat, _attrs, _result)
692 _result, = _result
693 return _result
696@_dispatch.add_fallback_dispatch_list
697@_dispatch.add_type_based_api_dispatcher
698@tf_export('signal.ifft2d', v1=['signal.ifft2d', 'spectral.ifft2d', 'ifft2d'])
699@deprecated_endpoints('spectral.ifft2d', 'ifft2d')
700def ifft2d(input, name=None):
701 r"""Inverse 2D fast Fourier transform.
703 Computes the inverse 2-dimensional discrete Fourier transform over the
704 inner-most 2 dimensions of `input`.
706 Args:
707 input: A `Tensor`. Must be one of the following types: `complex64`, `complex128`.
708 A complex tensor.
709 name: A name for the operation (optional).
711 Returns:
712 A `Tensor`. Has the same type as `input`.
713 """
714 _ctx = _context._context or _context.context()
715 tld = _ctx._thread_local_data
716 if tld.is_eager:
717 try:
718 _result = pywrap_tfe.TFE_Py_FastPathExecute(
719 _ctx, "IFFT2D", name, input)
720 return _result
721 except _core._NotOkStatusException as e:
722 _ops.raise_from_not_ok_status(e, name)
723 except _core._FallbackException:
724 pass
725 try:
726 _result = _dispatcher_for_ifft2d(
727 (input, name,), None)
728 if _result is not NotImplemented:
729 return _result
730 return ifft2d_eager_fallback(
731 input, name=name, ctx=_ctx)
732 except _core._SymbolicException:
733 pass # Add nodes to the TensorFlow graph.
734 except (TypeError, ValueError):
735 _result = _dispatch.dispatch(
736 ifft2d, (), dict(input=input, name=name)
737 )
738 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED:
739 return _result
740 raise
741 else:
742 _result = _dispatcher_for_ifft2d(
743 (input, name,), None)
744 if _result is not NotImplemented:
745 return _result
746 # Add nodes to the TensorFlow graph.
747 try:
748 _, _, _op, _outputs = _op_def_library._apply_op_helper(
749 "IFFT2D", input=input, name=name)
750 except (TypeError, ValueError):
751 _result = _dispatch.dispatch(
752 ifft2d, (), dict(input=input, name=name)
753 )
754 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED:
755 return _result
756 raise
757 _result = _outputs[:]
758 if _execute.must_record_gradient():
759 _attrs = ("Tcomplex", _op._get_attr_type("Tcomplex"))
760 _inputs_flat = _op.inputs
761 _execute.record_gradient(
762 "IFFT2D", _inputs_flat, _attrs, _result)
763 _result, = _result
764 return _result
766IFFT2D = tf_export("raw_ops.IFFT2D")(_ops.to_raw_op(ifft2d))
767_dispatcher_for_ifft2d = ifft2d._tf_type_based_dispatcher.Dispatch
770def ifft2d_eager_fallback(input, name, ctx):
771 _attr_Tcomplex, (input,) = _execute.args_to_matching_eager([input], ctx, [_dtypes.complex64, _dtypes.complex128, ], _dtypes.complex64)
772 _inputs_flat = [input]
773 _attrs = ("Tcomplex", _attr_Tcomplex)
774 _result = _execute.execute(b"IFFT2D", 1, inputs=_inputs_flat, attrs=_attrs,
775 ctx=ctx, name=name)
776 if _execute.must_record_gradient():
777 _execute.record_gradient(
778 "IFFT2D", _inputs_flat, _attrs, _result)
779 _result, = _result
780 return _result
783@_dispatch.add_fallback_dispatch_list
784@_dispatch.add_type_based_api_dispatcher
785@tf_export('signal.ifft3d', v1=['signal.ifft3d', 'spectral.ifft3d', 'ifft3d'])
786@deprecated_endpoints('spectral.ifft3d', 'ifft3d')
787def ifft3d(input, name=None):
788 r"""Inverse 3D fast Fourier transform.
790 Computes the inverse 3-dimensional discrete Fourier transform over the
791 inner-most 3 dimensions of `input`.
793 Args:
794 input: A `Tensor`. Must be one of the following types: `complex64`, `complex128`.
795 A complex tensor.
796 name: A name for the operation (optional).
798 Returns:
799 A `Tensor`. Has the same type as `input`.
800 """
801 _ctx = _context._context or _context.context()
802 tld = _ctx._thread_local_data
803 if tld.is_eager:
804 try:
805 _result = pywrap_tfe.TFE_Py_FastPathExecute(
806 _ctx, "IFFT3D", name, input)
807 return _result
808 except _core._NotOkStatusException as e:
809 _ops.raise_from_not_ok_status(e, name)
810 except _core._FallbackException:
811 pass
812 try:
813 _result = _dispatcher_for_ifft3d(
814 (input, name,), None)
815 if _result is not NotImplemented:
816 return _result
817 return ifft3d_eager_fallback(
818 input, name=name, ctx=_ctx)
819 except _core._SymbolicException:
820 pass # Add nodes to the TensorFlow graph.
821 except (TypeError, ValueError):
822 _result = _dispatch.dispatch(
823 ifft3d, (), dict(input=input, name=name)
824 )
825 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED:
826 return _result
827 raise
828 else:
829 _result = _dispatcher_for_ifft3d(
830 (input, name,), None)
831 if _result is not NotImplemented:
832 return _result
833 # Add nodes to the TensorFlow graph.
834 try:
835 _, _, _op, _outputs = _op_def_library._apply_op_helper(
836 "IFFT3D", input=input, name=name)
837 except (TypeError, ValueError):
838 _result = _dispatch.dispatch(
839 ifft3d, (), dict(input=input, name=name)
840 )
841 if _result is not _dispatch.OpDispatcher.NOT_SUPPORTED:
842 return _result
843 raise
844 _result = _outputs[:]
845 if _execute.must_record_gradient():
846 _attrs = ("Tcomplex", _op._get_attr_type("Tcomplex"))
847 _inputs_flat = _op.inputs
848 _execute.record_gradient(
849 "IFFT3D", _inputs_flat, _attrs, _result)
850 _result, = _result
851 return _result
853IFFT3D = tf_export("raw_ops.IFFT3D")(_ops.to_raw_op(ifft3d))
854_dispatcher_for_ifft3d = ifft3d._tf_type_based_dispatcher.Dispatch
857def ifft3d_eager_fallback(input, name, ctx):
858 _attr_Tcomplex, (input,) = _execute.args_to_matching_eager([input], ctx, [_dtypes.complex64, _dtypes.complex128, ], _dtypes.complex64)
859 _inputs_flat = [input]
860 _attrs = ("Tcomplex", _attr_Tcomplex)
861 _result = _execute.execute(b"IFFT3D", 1, inputs=_inputs_flat, attrs=_attrs,
862 ctx=ctx, name=name)
863 if _execute.must_record_gradient():
864 _execute.record_gradient(
865 "IFFT3D", _inputs_flat, _attrs, _result)
866 _result, = _result
867 return _result
870def irfft(input, fft_length, Treal=_dtypes.float32, name=None):
871 r"""Inverse real-valued fast Fourier transform.
873 Computes the inverse 1-dimensional discrete Fourier transform of a real-valued
874 signal over the inner-most dimension of `input`.
876 The inner-most dimension of `input` is assumed to be the result of `RFFT`: the
877 `fft_length / 2 + 1` unique components of the DFT of a real-valued signal. If
878 `fft_length` is not provided, it is computed from the size of the inner-most
879 dimension of `input` (`fft_length = 2 * (inner - 1)`). If the FFT length used to
880 compute `input` is odd, it should be provided since it cannot be inferred
881 properly.
883 Along the axis `IRFFT` is computed on, if `fft_length / 2 + 1` is smaller
884 than the corresponding dimension of `input`, the dimension is cropped. If it is
885 larger, the dimension is padded with zeros.
887 Args:
888 input: A `Tensor`. Must be one of the following types: `complex64`, `complex128`.
889 A complex tensor.
890 fft_length: A `Tensor` of type `int32`.
891 An int32 tensor of shape [1]. The FFT length.
892 Treal: An optional `tf.DType` from: `tf.float32, tf.float64`. Defaults to `tf.float32`.
893 name: A name for the operation (optional).
895 Returns:
896 A `Tensor` of type `Treal`.
897 """
898 _ctx = _context._context or _context.context()
899 tld = _ctx._thread_local_data
900 if tld.is_eager:
901 try:
902 _result = pywrap_tfe.TFE_Py_FastPathExecute(
903 _ctx, "IRFFT", name, input, fft_length, "Treal", Treal)
904 return _result
905 except _core._NotOkStatusException as e:
906 _ops.raise_from_not_ok_status(e, name)
907 except _core._FallbackException:
908 pass
909 try:
910 return irfft_eager_fallback(
911 input, fft_length, Treal=Treal, name=name, ctx=_ctx)
912 except _core._SymbolicException:
913 pass # Add nodes to the TensorFlow graph.
914 # Add nodes to the TensorFlow graph.
915 if Treal is None:
916 Treal = _dtypes.float32
917 Treal = _execute.make_type(Treal, "Treal")
918 _, _, _op, _outputs = _op_def_library._apply_op_helper(
919 "IRFFT", input=input, fft_length=fft_length, Treal=Treal, name=name)
920 _result = _outputs[:]
921 if _execute.must_record_gradient():
922 _attrs = ("Treal", _op._get_attr_type("Treal"), "Tcomplex",
923 _op._get_attr_type("Tcomplex"))
924 _inputs_flat = _op.inputs
925 _execute.record_gradient(
926 "IRFFT", _inputs_flat, _attrs, _result)
927 _result, = _result
928 return _result
930IRFFT = tf_export("raw_ops.IRFFT")(_ops.to_raw_op(irfft))
933def irfft_eager_fallback(input, fft_length, Treal, name, ctx):
934 if Treal is None:
935 Treal = _dtypes.float32
936 Treal = _execute.make_type(Treal, "Treal")
937 _attr_Tcomplex, (input,) = _execute.args_to_matching_eager([input], ctx, [_dtypes.complex64, _dtypes.complex128, ], _dtypes.complex64)
938 fft_length = _ops.convert_to_tensor(fft_length, _dtypes.int32)
939 _inputs_flat = [input, fft_length]
940 _attrs = ("Treal", Treal, "Tcomplex", _attr_Tcomplex)
941 _result = _execute.execute(b"IRFFT", 1, inputs=_inputs_flat, attrs=_attrs,
942 ctx=ctx, name=name)
943 if _execute.must_record_gradient():
944 _execute.record_gradient(
945 "IRFFT", _inputs_flat, _attrs, _result)
946 _result, = _result
947 return _result
950def irfft2d(input, fft_length, Treal=_dtypes.float32, name=None):
951 r"""Inverse 2D real-valued fast Fourier transform.
953 Computes the inverse 2-dimensional discrete Fourier transform of a real-valued
954 signal over the inner-most 2 dimensions of `input`.
956 The inner-most 2 dimensions of `input` are assumed to be the result of `RFFT2D`:
957 The inner-most dimension contains the `fft_length / 2 + 1` unique components of
958 the DFT of a real-valued signal. If `fft_length` is not provided, it is computed
959 from the size of the inner-most 2 dimensions of `input`. If the FFT length used
960 to compute `input` is odd, it should be provided since it cannot be inferred
961 properly.
963 Along each axis `IRFFT2D` is computed on, if `fft_length` (or
964 `fft_length / 2 + 1` for the inner-most dimension) is smaller than the
965 corresponding dimension of `input`, the dimension is cropped. If it is larger,
966 the dimension is padded with zeros.
968 Args:
969 input: A `Tensor`. Must be one of the following types: `complex64`, `complex128`.
970 A complex tensor.
971 fft_length: A `Tensor` of type `int32`.
972 An int32 tensor of shape [2]. The FFT length for each dimension.
973 Treal: An optional `tf.DType` from: `tf.float32, tf.float64`. Defaults to `tf.float32`.
974 name: A name for the operation (optional).
976 Returns:
977 A `Tensor` of type `Treal`.
978 """
979 _ctx = _context._context or _context.context()
980 tld = _ctx._thread_local_data
981 if tld.is_eager:
982 try:
983 _result = pywrap_tfe.TFE_Py_FastPathExecute(
984 _ctx, "IRFFT2D", name, input, fft_length, "Treal", Treal)
985 return _result
986 except _core._NotOkStatusException as e:
987 _ops.raise_from_not_ok_status(e, name)
988 except _core._FallbackException:
989 pass
990 try:
991 return irfft2d_eager_fallback(
992 input, fft_length, Treal=Treal, name=name, ctx=_ctx)
993 except _core._SymbolicException:
994 pass # Add nodes to the TensorFlow graph.
995 # Add nodes to the TensorFlow graph.
996 if Treal is None:
997 Treal = _dtypes.float32
998 Treal = _execute.make_type(Treal, "Treal")
999 _, _, _op, _outputs = _op_def_library._apply_op_helper(
1000 "IRFFT2D", input=input, fft_length=fft_length, Treal=Treal, name=name)
1001 _result = _outputs[:]
1002 if _execute.must_record_gradient():
1003 _attrs = ("Treal", _op._get_attr_type("Treal"), "Tcomplex",
1004 _op._get_attr_type("Tcomplex"))
1005 _inputs_flat = _op.inputs
1006 _execute.record_gradient(
1007 "IRFFT2D", _inputs_flat, _attrs, _result)
1008 _result, = _result
1009 return _result
1011IRFFT2D = tf_export("raw_ops.IRFFT2D")(_ops.to_raw_op(irfft2d))
1014def irfft2d_eager_fallback(input, fft_length, Treal, name, ctx):
1015 if Treal is None:
1016 Treal = _dtypes.float32
1017 Treal = _execute.make_type(Treal, "Treal")
1018 _attr_Tcomplex, (input,) = _execute.args_to_matching_eager([input], ctx, [_dtypes.complex64, _dtypes.complex128, ], _dtypes.complex64)
1019 fft_length = _ops.convert_to_tensor(fft_length, _dtypes.int32)
1020 _inputs_flat = [input, fft_length]
1021 _attrs = ("Treal", Treal, "Tcomplex", _attr_Tcomplex)
1022 _result = _execute.execute(b"IRFFT2D", 1, inputs=_inputs_flat, attrs=_attrs,
1023 ctx=ctx, name=name)
1024 if _execute.must_record_gradient():
1025 _execute.record_gradient(
1026 "IRFFT2D", _inputs_flat, _attrs, _result)
1027 _result, = _result
1028 return _result
1031def irfft3d(input, fft_length, Treal=_dtypes.float32, name=None):
1032 r"""Inverse 3D real-valued fast Fourier transform.
1034 Computes the inverse 3-dimensional discrete Fourier transform of a real-valued
1035 signal over the inner-most 3 dimensions of `input`.
1037 The inner-most 3 dimensions of `input` are assumed to be the result of `RFFT3D`:
1038 The inner-most dimension contains the `fft_length / 2 + 1` unique components of
1039 the DFT of a real-valued signal. If `fft_length` is not provided, it is computed
1040 from the size of the inner-most 3 dimensions of `input`. If the FFT length used
1041 to compute `input` is odd, it should be provided since it cannot be inferred
1042 properly.
1044 Along each axis `IRFFT3D` is computed on, if `fft_length` (or
1045 `fft_length / 2 + 1` for the inner-most dimension) is smaller than the
1046 corresponding dimension of `input`, the dimension is cropped. If it is larger,
1047 the dimension is padded with zeros.
1049 Args:
1050 input: A `Tensor`. Must be one of the following types: `complex64`, `complex128`.
1051 A complex tensor.
1052 fft_length: A `Tensor` of type `int32`.
1053 An int32 tensor of shape [3]. The FFT length for each dimension.
1054 Treal: An optional `tf.DType` from: `tf.float32, tf.float64`. Defaults to `tf.float32`.
1055 name: A name for the operation (optional).
1057 Returns:
1058 A `Tensor` of type `Treal`.
1059 """
1060 _ctx = _context._context or _context.context()
1061 tld = _ctx._thread_local_data
1062 if tld.is_eager:
1063 try:
1064 _result = pywrap_tfe.TFE_Py_FastPathExecute(
1065 _ctx, "IRFFT3D", name, input, fft_length, "Treal", Treal)
1066 return _result
1067 except _core._NotOkStatusException as e:
1068 _ops.raise_from_not_ok_status(e, name)
1069 except _core._FallbackException:
1070 pass
1071 try:
1072 return irfft3d_eager_fallback(
1073 input, fft_length, Treal=Treal, name=name, ctx=_ctx)
1074 except _core._SymbolicException:
1075 pass # Add nodes to the TensorFlow graph.
1076 # Add nodes to the TensorFlow graph.
1077 if Treal is None:
1078 Treal = _dtypes.float32
1079 Treal = _execute.make_type(Treal, "Treal")
1080 _, _, _op, _outputs = _op_def_library._apply_op_helper(
1081 "IRFFT3D", input=input, fft_length=fft_length, Treal=Treal, name=name)
1082 _result = _outputs[:]
1083 if _execute.must_record_gradient():
1084 _attrs = ("Treal", _op._get_attr_type("Treal"), "Tcomplex",
1085 _op._get_attr_type("Tcomplex"))
1086 _inputs_flat = _op.inputs
1087 _execute.record_gradient(
1088 "IRFFT3D", _inputs_flat, _attrs, _result)
1089 _result, = _result
1090 return _result
1092IRFFT3D = tf_export("raw_ops.IRFFT3D")(_ops.to_raw_op(irfft3d))
1095def irfft3d_eager_fallback(input, fft_length, Treal, name, ctx):
1096 if Treal is None:
1097 Treal = _dtypes.float32
1098 Treal = _execute.make_type(Treal, "Treal")
1099 _attr_Tcomplex, (input,) = _execute.args_to_matching_eager([input], ctx, [_dtypes.complex64, _dtypes.complex128, ], _dtypes.complex64)
1100 fft_length = _ops.convert_to_tensor(fft_length, _dtypes.int32)
1101 _inputs_flat = [input, fft_length]
1102 _attrs = ("Treal", Treal, "Tcomplex", _attr_Tcomplex)
1103 _result = _execute.execute(b"IRFFT3D", 1, inputs=_inputs_flat, attrs=_attrs,
1104 ctx=ctx, name=name)
1105 if _execute.must_record_gradient():
1106 _execute.record_gradient(
1107 "IRFFT3D", _inputs_flat, _attrs, _result)
1108 _result, = _result
1109 return _result
1112def rfft(input, fft_length, Tcomplex=_dtypes.complex64, name=None):
1113 r"""Real-valued fast Fourier transform.
1115 Computes the 1-dimensional discrete Fourier transform of a real-valued signal
1116 over the inner-most dimension of `input`.
1118 Since the DFT of a real signal is Hermitian-symmetric, `RFFT` only returns the
1119 `fft_length / 2 + 1` unique components of the FFT: the zero-frequency term,
1120 followed by the `fft_length / 2` positive-frequency terms.
1122 Along the axis `RFFT` is computed on, if `fft_length` is smaller than the
1123 corresponding dimension of `input`, the dimension is cropped. If it is larger,
1124 the dimension is padded with zeros.
1126 Args:
1127 input: A `Tensor`. Must be one of the following types: `float32`, `float64`.
1128 A float32 tensor.
1129 fft_length: A `Tensor` of type `int32`.
1130 An int32 tensor of shape [1]. The FFT length.
1131 Tcomplex: An optional `tf.DType` from: `tf.complex64, tf.complex128`. Defaults to `tf.complex64`.
1132 name: A name for the operation (optional).
1134 Returns:
1135 A `Tensor` of type `Tcomplex`.
1136 """
1137 _ctx = _context._context or _context.context()
1138 tld = _ctx._thread_local_data
1139 if tld.is_eager:
1140 try:
1141 _result = pywrap_tfe.TFE_Py_FastPathExecute(
1142 _ctx, "RFFT", name, input, fft_length, "Tcomplex", Tcomplex)
1143 return _result
1144 except _core._NotOkStatusException as e:
1145 _ops.raise_from_not_ok_status(e, name)
1146 except _core._FallbackException:
1147 pass
1148 try:
1149 return rfft_eager_fallback(
1150 input, fft_length, Tcomplex=Tcomplex, name=name, ctx=_ctx)
1151 except _core._SymbolicException:
1152 pass # Add nodes to the TensorFlow graph.
1153 # Add nodes to the TensorFlow graph.
1154 if Tcomplex is None:
1155 Tcomplex = _dtypes.complex64
1156 Tcomplex = _execute.make_type(Tcomplex, "Tcomplex")
1157 _, _, _op, _outputs = _op_def_library._apply_op_helper(
1158 "RFFT", input=input, fft_length=fft_length, Tcomplex=Tcomplex,
1159 name=name)
1160 _result = _outputs[:]
1161 if _execute.must_record_gradient():
1162 _attrs = ("Treal", _op._get_attr_type("Treal"), "Tcomplex",
1163 _op._get_attr_type("Tcomplex"))
1164 _inputs_flat = _op.inputs
1165 _execute.record_gradient(
1166 "RFFT", _inputs_flat, _attrs, _result)
1167 _result, = _result
1168 return _result
1170RFFT = tf_export("raw_ops.RFFT")(_ops.to_raw_op(rfft))
1173def rfft_eager_fallback(input, fft_length, Tcomplex, name, ctx):
1174 if Tcomplex is None:
1175 Tcomplex = _dtypes.complex64
1176 Tcomplex = _execute.make_type(Tcomplex, "Tcomplex")
1177 _attr_Treal, (input,) = _execute.args_to_matching_eager([input], ctx, [_dtypes.float32, _dtypes.float64, ], _dtypes.float32)
1178 fft_length = _ops.convert_to_tensor(fft_length, _dtypes.int32)
1179 _inputs_flat = [input, fft_length]
1180 _attrs = ("Treal", _attr_Treal, "Tcomplex", Tcomplex)
1181 _result = _execute.execute(b"RFFT", 1, inputs=_inputs_flat, attrs=_attrs,
1182 ctx=ctx, name=name)
1183 if _execute.must_record_gradient():
1184 _execute.record_gradient(
1185 "RFFT", _inputs_flat, _attrs, _result)
1186 _result, = _result
1187 return _result
1190def rfft2d(input, fft_length, Tcomplex=_dtypes.complex64, name=None):
1191 r"""2D real-valued fast Fourier transform.
1193 Computes the 2-dimensional discrete Fourier transform of a real-valued signal
1194 over the inner-most 2 dimensions of `input`.
1196 Since the DFT of a real signal is Hermitian-symmetric, `RFFT2D` only returns the
1197 `fft_length / 2 + 1` unique components of the FFT for the inner-most dimension
1198 of `output`: the zero-frequency term, followed by the `fft_length / 2`
1199 positive-frequency terms.
1201 Along each axis `RFFT2D` is computed on, if `fft_length` is smaller than the
1202 corresponding dimension of `input`, the dimension is cropped. If it is larger,
1203 the dimension is padded with zeros.
1205 Args:
1206 input: A `Tensor`. Must be one of the following types: `float32`, `float64`.
1207 A float32 tensor.
1208 fft_length: A `Tensor` of type `int32`.
1209 An int32 tensor of shape [2]. The FFT length for each dimension.
1210 Tcomplex: An optional `tf.DType` from: `tf.complex64, tf.complex128`. Defaults to `tf.complex64`.
1211 name: A name for the operation (optional).
1213 Returns:
1214 A `Tensor` of type `Tcomplex`.
1215 """
1216 _ctx = _context._context or _context.context()
1217 tld = _ctx._thread_local_data
1218 if tld.is_eager:
1219 try:
1220 _result = pywrap_tfe.TFE_Py_FastPathExecute(
1221 _ctx, "RFFT2D", name, input, fft_length, "Tcomplex", Tcomplex)
1222 return _result
1223 except _core._NotOkStatusException as e:
1224 _ops.raise_from_not_ok_status(e, name)
1225 except _core._FallbackException:
1226 pass
1227 try:
1228 return rfft2d_eager_fallback(
1229 input, fft_length, Tcomplex=Tcomplex, name=name, ctx=_ctx)
1230 except _core._SymbolicException:
1231 pass # Add nodes to the TensorFlow graph.
1232 # Add nodes to the TensorFlow graph.
1233 if Tcomplex is None:
1234 Tcomplex = _dtypes.complex64
1235 Tcomplex = _execute.make_type(Tcomplex, "Tcomplex")
1236 _, _, _op, _outputs = _op_def_library._apply_op_helper(
1237 "RFFT2D", input=input, fft_length=fft_length, Tcomplex=Tcomplex,
1238 name=name)
1239 _result = _outputs[:]
1240 if _execute.must_record_gradient():
1241 _attrs = ("Treal", _op._get_attr_type("Treal"), "Tcomplex",
1242 _op._get_attr_type("Tcomplex"))
1243 _inputs_flat = _op.inputs
1244 _execute.record_gradient(
1245 "RFFT2D", _inputs_flat, _attrs, _result)
1246 _result, = _result
1247 return _result
1249RFFT2D = tf_export("raw_ops.RFFT2D")(_ops.to_raw_op(rfft2d))
1252def rfft2d_eager_fallback(input, fft_length, Tcomplex, name, ctx):
1253 if Tcomplex is None:
1254 Tcomplex = _dtypes.complex64
1255 Tcomplex = _execute.make_type(Tcomplex, "Tcomplex")
1256 _attr_Treal, (input,) = _execute.args_to_matching_eager([input], ctx, [_dtypes.float32, _dtypes.float64, ], _dtypes.float32)
1257 fft_length = _ops.convert_to_tensor(fft_length, _dtypes.int32)
1258 _inputs_flat = [input, fft_length]
1259 _attrs = ("Treal", _attr_Treal, "Tcomplex", Tcomplex)
1260 _result = _execute.execute(b"RFFT2D", 1, inputs=_inputs_flat, attrs=_attrs,
1261 ctx=ctx, name=name)
1262 if _execute.must_record_gradient():
1263 _execute.record_gradient(
1264 "RFFT2D", _inputs_flat, _attrs, _result)
1265 _result, = _result
1266 return _result
1269def rfft3d(input, fft_length, Tcomplex=_dtypes.complex64, name=None):
1270 r"""3D real-valued fast Fourier transform.
1272 Computes the 3-dimensional discrete Fourier transform of a real-valued signal
1273 over the inner-most 3 dimensions of `input`.
1275 Since the DFT of a real signal is Hermitian-symmetric, `RFFT3D` only returns the
1276 `fft_length / 2 + 1` unique components of the FFT for the inner-most dimension
1277 of `output`: the zero-frequency term, followed by the `fft_length / 2`
1278 positive-frequency terms.
1280 Along each axis `RFFT3D` is computed on, if `fft_length` is smaller than the
1281 corresponding dimension of `input`, the dimension is cropped. If it is larger,
1282 the dimension is padded with zeros.
1284 Args:
1285 input: A `Tensor`. Must be one of the following types: `float32`, `float64`.
1286 A float32 tensor.
1287 fft_length: A `Tensor` of type `int32`.
1288 An int32 tensor of shape [3]. The FFT length for each dimension.
1289 Tcomplex: An optional `tf.DType` from: `tf.complex64, tf.complex128`. Defaults to `tf.complex64`.
1290 name: A name for the operation (optional).
1292 Returns:
1293 A `Tensor` of type `Tcomplex`.
1294 """
1295 _ctx = _context._context or _context.context()
1296 tld = _ctx._thread_local_data
1297 if tld.is_eager:
1298 try:
1299 _result = pywrap_tfe.TFE_Py_FastPathExecute(
1300 _ctx, "RFFT3D", name, input, fft_length, "Tcomplex", Tcomplex)
1301 return _result
1302 except _core._NotOkStatusException as e:
1303 _ops.raise_from_not_ok_status(e, name)
1304 except _core._FallbackException:
1305 pass
1306 try:
1307 return rfft3d_eager_fallback(
1308 input, fft_length, Tcomplex=Tcomplex, name=name, ctx=_ctx)
1309 except _core._SymbolicException:
1310 pass # Add nodes to the TensorFlow graph.
1311 # Add nodes to the TensorFlow graph.
1312 if Tcomplex is None:
1313 Tcomplex = _dtypes.complex64
1314 Tcomplex = _execute.make_type(Tcomplex, "Tcomplex")
1315 _, _, _op, _outputs = _op_def_library._apply_op_helper(
1316 "RFFT3D", input=input, fft_length=fft_length, Tcomplex=Tcomplex,
1317 name=name)
1318 _result = _outputs[:]
1319 if _execute.must_record_gradient():
1320 _attrs = ("Treal", _op._get_attr_type("Treal"), "Tcomplex",
1321 _op._get_attr_type("Tcomplex"))
1322 _inputs_flat = _op.inputs
1323 _execute.record_gradient(
1324 "RFFT3D", _inputs_flat, _attrs, _result)
1325 _result, = _result
1326 return _result
1328RFFT3D = tf_export("raw_ops.RFFT3D")(_ops.to_raw_op(rfft3d))
1331def rfft3d_eager_fallback(input, fft_length, Tcomplex, name, ctx):
1332 if Tcomplex is None:
1333 Tcomplex = _dtypes.complex64
1334 Tcomplex = _execute.make_type(Tcomplex, "Tcomplex")
1335 _attr_Treal, (input,) = _execute.args_to_matching_eager([input], ctx, [_dtypes.float32, _dtypes.float64, ], _dtypes.float32)
1336 fft_length = _ops.convert_to_tensor(fft_length, _dtypes.int32)
1337 _inputs_flat = [input, fft_length]
1338 _attrs = ("Treal", _attr_Treal, "Tcomplex", Tcomplex)
1339 _result = _execute.execute(b"RFFT3D", 1, inputs=_inputs_flat, attrs=_attrs,
1340 ctx=ctx, name=name)
1341 if _execute.must_record_gradient():
1342 _execute.record_gradient(
1343 "RFFT3D", _inputs_flat, _attrs, _result)
1344 _result, = _result
1345 return _result