Skip to content

tf.signal.kaiser_bessel_derived_window returns window_length - 1 samples for odd lengths #129235

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?

The docstring says the result has shape [window_length]. For odd lengths the implementation (window_ops.py#L127-L131) builds two halves of window_length // 2 samples each, so the output is one sample short. For window_length=1 it is empty.

KBD windows are normally defined for even lengths only, so the right behavior is probably to raise a clear error for odd window_length (or document the restriction), not to quietly return a shorter window. Right now callers that pair the window with a frame of window_length samples get a shape mismatch later on, far from the cause.

Expected: either shape [window_length], or a ValueError/InvalidArgumentError for odd lengths.

Standalone code to reproduce the issue

import tensorflow as tf

for n in [1, 2, 3, 5, 6]:
  print(n, tf.signal.kaiser_bessel_derived_window(n).shape)

Relevant log output

1 (0,)
2 (2,)
3 (2,)
5 (4,)
6 (6,)

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