{"record":{"id":"6779573ecf154437","repo":"keras-team/keras","slug":"the-shape-of-window-must-be-equal-to-sequence-l","errorCode":null,"errorMessage":"The shape of `window` must be equal to [sequence_length].Received: window shape={win.shape}","messagePattern":"The shape of `window` must be equal to \\[sequence_length\\]\\.Received: window shape=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/jax/math.py","lineNumber":201,"sourceCode":"    x = convert_to_tensor(x)\n\n    if center:\n        pad_width = [(0, 0) for _ in range(len(x.shape))]\n        pad_width[-1] = (fft_length // 2, fft_length // 2)\n        x = jnp.pad(x, pad_width, mode=\"reflect\")\n\n    l_pad = (fft_length - sequence_length) // 2\n    r_pad = fft_length - sequence_length - l_pad\n\n    if window is not None:\n        if isinstance(window, str):\n            win = convert_to_tensor(\n                scipy.signal.get_window(window, sequence_length), dtype=x.dtype\n            )\n        else:\n            win = convert_to_tensor(window, dtype=x.dtype)\n        if len(win.shape) != 1 or win.shape[-1] != sequence_length:\n            raise ValueError(\n                \"The shape of `window` must be equal to [sequence_length].\"\n                f\"Received: window shape={win.shape}\"\n            )\n        win = jnp.pad(win, [[l_pad, r_pad]])\n    else:\n        win = jnp.ones((sequence_length + l_pad + r_pad), dtype=x.dtype)\n\n    result = jax.scipy.signal.stft(\n        x,\n        fs=1.0,\n        window=win,\n        nperseg=(sequence_length + l_pad + r_pad),\n        noverlap=(sequence_length + l_pad + r_pad - sequence_stride),\n        nfft=fft_length,\n        boundary=None,\n        padded=False,\n    )[-1]\n    # scale and swap to (..., num_sequences, fft_bins)","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/jax/math.py#L183-L219","documentation":"Error \"The shape of `window` must be equal to [sequence_length].Received: window shape={win.shape}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/jax/math.py:201 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}