tf.signal.ifft2d` / `tf.signal.irfft` produce different CPU vs GPU NaN propagation for small `complex64` inputs containing `Inf
Maintainer antworten meist innerhalb von 2 Tagen
@Kayyuri arbeitet bereits daran.
Seit 13.10.2026.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
Issue type
Bug
Have you reproduced the bug with TensorFlow Nightly?
Yes
Source
source
TensorFlow version
2.20.0
Custom code
Yes
OS platform and distribution
No response
Mobile device
No response
Python version
3.11.14
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current behavior?
For small complex64 FFT inputs containing Inf, TensorFlow CPU and GPU produce different NaN propagation patterns.
Two examples are stable in three isolated runs:
tf.signal.ifft2d([[inf+0j, 1+0j], [2+0j, 3+0j]])- CPU imaginary components are finite zeros.
- GPU imaginary components are all
NaN. - NumPy matches the TensorFlow CPU pattern.
tf.signal.irfft([1+2j, inf+0j, -4+0j])- CPU returns
[inf, 1.25, -inf, 1.25]. - GPU returns
[inf, nan, -inf, nan]. - NumPy matches the TensorFlow CPU pattern.
- CPU returns
A stronger non-finite control, tf.signal.irfft([1+2j, inf-3j, -4+infj]), returns all NaN on CPU, GPU, and NumPy, so the issue is not that all non-finite FFT outputs are being flagged as wrong.
Expected behavior
If TensorFlow considers CPU and GPU FFT non-finite propagation to have the same semantic contract, these small inputs should produce consistent NaN/Inf patterns across devices.
If backend-specific non-finite propagation is expected for FFT kernels, it would be helpful for the documentation or error notes to make that explicit. I am filing this as a CPU/GPU consistency issue rather than a strict finite-value correctness claim.
Standalone code to reproduce the issue
import numpy as np
import tensorflow as tf
print("TensorFlow:", tf.__version__)
print("GPUs:", tf.config.list_physical_devices("GPU"))
def run(device):
with tf.device(device):
a = tf.constant(
np.array(
[[np.inf + 0j, 1 + 0j], [2 + 0j, 3 + 0j]],
dtype=np.complex64,
)
)
b = tf.constant(
np.array([1 + 2j, np.inf + 0j, -4 + 0j], dtype=np.complex64)
)
c = tf.constant(
np.array([1 + 2j, np.inf - 3j, -4 + np.inf * 1j], dtype=np.complex64)
)
return {
"ifft2d": tf.signal.ifft2d(a).numpy(),
"irfft": tf.signal.irfft(b).numpy(),
"irfft_control": tf.signal.irfft(c).numpy(),
}
cpu = run("/CPU:0")
gpu = run("/GPU:0")
np_ifft2d = np.fft.ifft2(
np.array([[np.inf + 0j, 1 + 0j], [2 + 0j, 3 + 0j]], dtype=np.complex64)
)
np_irfft = np.fft.irfft(
np.array([1 + 2j, np.inf + 0j, -4 + 0j], dtype=np.complex64)
)
np_control = np.fft.irfft(
np.array([1 + 2j, np.inf - 3j, -4 + np.inf * 1j], dtype=np.complex64)
)
for name in ["ifft2d", "irfft", "irfft_control"]:
print("\n", name)
print("CPU:", cpu[name])
print("GPU:", gpu[name])
print("\nNumPy ifft2d:", np_ifft2d)
print("NumPy irfft:", np_irfft)
print("NumPy control:", np_control)
Relevant log output
TensorFlow: 2.20.0
ifft2d
CPU: [[inf+0.j inf+0.j]
[inf+0.j inf+0.j]]
GPU: [[inf+nanj inf+nanj]
[inf+nanj inf+nanj]]
irfft
CPU: [ inf 1.25 -inf 1.25]
GPU: [ inf nan -inf nan]
irfft_control
CPU: [nan nan nan nan]
GPU: [nan nan nan nan]
NumPy ifft2d: [[inf+0.j inf+0.j]
[inf+0.j inf+0.j]]
NumPy irfft: [ inf 1.25 -inf 1.25]
NumPy control: [nan nan nan nan]
- Vorherrschende Sprache
- C++
- Sterne
- 201k
- Forks
- 78.4k
- Ø Merge
- 3 T. 2 Std.
- Gemergte PRs (30 T.)
- 452
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus tensorflow/tensorflow
-
tf.image.adjust_hue and tf.image.adjust_saturation have no gradient: LookupError under tf.function, silent None in eagerEvtl. vergeben @Venkat6871 hat das heute übernommen. Offentype:bug
tensorflow/tensorflow#130207 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 2 Tagen
-
tf.image.hsv_to_rgb has no gradient: registered NotDifferentiable, tf.GradientTape returns NoneEvtl. vergeben @Venkat6871 hat das heute übernommen. Offentype:bug
tensorflow/tensorflow#130205 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 2 Tagen
-
tf.linalg.norm rejects NumPy integer axes (np.int64), while Python ints and np.linalg.norm workEvtl. vergeben @Venkat6871 hat das vor 1 Tag übernommen. Offen2.21.0 awaiting PR merge comp:ops type:bug
tensorflow/tensorflow#130195 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 2 Tagen
-
[docs] tf.nn.avg_pool2d / max_pool2d / max_pool_with_argmax: a length-4 `ksize`/`strides` with a non-1 batch entry is rejected ("Pooling is not yet supported on the batch dimension"), which the docs do not mentionEvtl. vergeben @Venkat6871 hat das vor 1 Tag übernommen. Offen2.21.0 awaiting PR merge comp:ops type:docs-bug
tensorflow/tensorflow#130189 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 2 Tagen
-
tf.nn.sampled_softmax_loss and tf.nn.nce_loss fail for float16, bfloat16 and float64 inputsEvtl. vergeben @Venkat6871 hat das vor 1 Tag übernommen. Offen2.21.0 awaiting PR merge comp:ops type:bug
tensorflow/tensorflow#130178 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 2 Tagen
Alle Issues in tensorflow/tensorflow
Ähnliche Issues
-
Bug Translations
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 82/100
wesnoth/wesnoth#11728 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
rpm-software-management/dnf5#3043 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 3 Tagen
-
test(tools): two testkit cache tests fail unless GOCACHE and GOMODCACHE are in the environmentOffenbacklog
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
EchoTools/nevr-runtime#2385 ·
Maintainer antworten meist innerhalb von 1 Tag
-
needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
AustinKelsay/dnd-diceroll#200 ·
Maintainer antworten meist innerhalb von 1 Tag