{"record":{"id":"6f62e47e23972520","repo":"keras-team/keras","slug":"the-shape-of-window-must-be-equal-to-sequence-l-6f62e4","errorCode":null,"errorMessage":"The shape of `window` must be equal to [sequence_length].Received: window shape={win_array.shape}","messagePattern":"The shape of `window` must be equal to \\[sequence_length\\]\\.Received: window shape=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/tensorflow/math.py","lineNumber":220,"sourceCode":"        x = tf.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            if window == \"hann\":\n                win_array = tf.signal.hann_window(\n                    sequence_length, periodic=True, dtype=x.dtype\n                )\n            else:\n                win_array = tf.signal.hamming_window(\n                    sequence_length, periodic=True, dtype=x.dtype\n                )\n        else:\n            win_array = convert_to_tensor(window, dtype=x.dtype)\n        if len(win_array.shape) != 1 or win_array.shape[-1] != sequence_length:\n            raise ValueError(\n                \"The shape of `window` must be equal to [sequence_length].\"\n                f\"Received: window shape={win_array.shape}\"\n            )\n        win_array = tf.pad(win_array, [[l_pad, r_pad]])\n\n        def win(frame_step, dtype):\n            return win_array\n\n    else:\n        win = None\n\n    result = tf.signal.stft(\n        x,\n        frame_length=(sequence_length + l_pad + r_pad),\n        frame_step=sequence_stride,\n        fft_length=fft_length,\n        window_fn=win,\n    )","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/tensorflow/math.py#L202-L238","documentation":"Error \"The shape of `window` must be equal to [sequence_length].Received: window shape={win_array.shape}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/tensorflow/math.py:220 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"}