{"record":{"id":"0bbc32b54e9f8e61","repo":"keras-team/keras","slug":"array-inputs-to-associative-scan-must-have-the-sam-0bbc32","errorCode":null,"errorMessage":"Array inputs to associative_scan must have the same first dimension. (saw: [tf.shape(elem) for elem in elems_flat])","messagePattern":"Array inputs to associative_scan must have the same first dimension\\. \\(saw: \\[tf\\.shape\\(elem\\) for elem in elems_flat\\]\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/tensorflow/core.py","lineNumber":427,"sourceCode":"    elems_flat = tree.flatten(elems)\n    elems_flat = [tf.convert_to_tensor(elem) for elem in elems_flat]\n    if reverse:\n        elems_flat = [tf.reverse(elem, [axis]) for elem in elems_flat]\n\n    def _combine(a_flat, b_flat):\n        a = tree.pack_sequence_as(elems, a_flat)\n        b = tree.pack_sequence_as(elems, b_flat)\n        c = f(a, b)\n        c_flat = tree.flatten(c)\n        return c_flat\n\n    def _get_dim(x):\n        return shape(x)[axis]\n\n    # TODO add constant dim check\n    num_elems = _get_dim(elems_flat[0])\n    if not all(_get_dim(elem) == num_elems for elem in elems_flat[1:]):\n        raise ValueError(\n            \"Array inputs to associative_scan must have the same \"\n            \"first dimension. (saw: {})\".format(\n                [tf.shape(elem) for elem in elems_flat]\n            )\n        )\n\n    def _interleave(a, b, axis):\n        # [a b c ...] [d e f ...] -> [a d b e c f ...]\n        num_elems_a = (\n            a.shape[axis] if a.shape[axis] is not None else tf.shape(a)[axis]\n        )\n        num_elems_b = (\n            b.shape[axis] if b.shape[axis] is not None else tf.shape(b)[axis]\n        )\n\n        # Note that interleaving implies rank(a)==rank(b).\n        axis = tf.where(axis >= 0, axis, tf.rank(a) + axis)\n        axis = (","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/tensorflow/core.py#L409-L445","documentation":"Error \"Array inputs to associative_scan must have the same first dimension. (saw: [tf.shape(elem) for elem in elems_flat])\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/tensorflow/core.py:427 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"}