Skip to content

tf.signal.kaiser_window returns [nan] for window_length=1 when the length is not a constant (tf.function) #129234

Closed

Description

@bodapatisaikrishna

Issue type

Bug

Have you reproduced the bug with TensorFlow Nightly?

Yes

Source

binary

TensorFlow version

tf-nightly 2.23.0-dev20261014 (git v1.12.1-146947-gfcb676979cd)

Custom code

Yes

OS platform and distribution

macOS 15.7.2 (arm64)

Mobile device

No response

Python version

3.11.7

Bazel version

No response

GCC/compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

kaiser_window special-cases a length of 1 only when it can read the length statically (window_length_const == 1, window_ops.py#L73). With a dynamic length, for example a tf.function input, halflen_float becomes 0, so arg / halflen_float is 0/0 = nan and the window is [nan].

hann_window/hamming_window handle the same case with a cond on window_length == 1, and they correctly return [1.] in the same setting. kaiser_window has no such guard.

Expected: [1.] (matches eager mode and np.kaiser(1, beta)).

Standalone code to reproduce the issue

import tensorflow as tf

print(tf.signal.kaiser_window(1))  # [1.]

@tf.function(input_signature=[tf.TensorSpec([], tf.int32)])
def kaiser(n):
  return tf.signal.kaiser_window(n)

print(kaiser(tf.constant(1)))      # expected [1.], got [nan]

Relevant log output

tf.Tensor([1.], shape=(1,), dtype=float32)
tf.Tensor([nan], shape=(1,), dtype=float32)

Activity

  1. added
    comp:ops
    comp:signal
    2.21.0
    on Oct 19, 2026
  2. Kayyuri commented on Oct 19, 2026

    @Kayyuri

    Hi @bodapatisaikrishna,
    Thanks for reporting this issue and submitting a fix for TensorFlow. Once the PR is merged, the issue will be resolved. We appreciate your contribution.

  3. google-ml-butler commented on Oct 22, 2026

    @google-ml-butler

    Are you satisfied with the resolution of your issue?
    Yes
    No

  4. added a commit that references this issue on Oct 22, 2026
    0089bd2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

2.21.0awaiting PR mergecomp:opscomp:signaltype:bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions