keras-team/keras · error · ValueError
The shape of `window` must be equal to [sequence_length].Rec
Error message
The shape of `window` must be equal to [sequence_length].Received: window shape={win.shape} What it means
Error "The shape of `window` must be equal to [sequence_length].Received: window shape={win.shape}" thrown in keras-team/keras.
Source
Thrown at keras/src/backend/jax/math.py:201
x = convert_to_tensor(x)
if center:
pad_width = [(0, 0) for _ in range(len(x.shape))]
pad_width[-1] = (fft_length // 2, fft_length // 2)
x = jnp.pad(x, pad_width, mode="reflect")
l_pad = (fft_length - sequence_length) // 2
r_pad = fft_length - sequence_length - l_pad
if window is not None:
if isinstance(window, str):
win = convert_to_tensor(
scipy.signal.get_window(window, sequence_length), dtype=x.dtype
)
else:
win = convert_to_tensor(window, dtype=x.dtype)
if len(win.shape) != 1 or win.shape[-1] != sequence_length:
raise ValueError(
"The shape of `window` must be equal to [sequence_length]."
f"Received: window shape={win.shape}"
)
win = jnp.pad(win, [[l_pad, r_pad]])
else:
win = jnp.ones((sequence_length + l_pad + r_pad), dtype=x.dtype)
result = jax.scipy.signal.stft(
x,
fs=1.0,
window=win,
nperseg=(sequence_length + l_pad + r_pad),
noverlap=(sequence_length + l_pad + r_pad - sequence_stride),
nfft=fft_length,
boundary=None,
padded=False,
)[-1]
# scale and swap to (..., num_sequences, fft_bins)View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/backend/jax/math.py:201 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25).
Data as JSON: /api/errors/6779573ecf154437.
Report an issue: GitHub.