{"record":{"id":"88b04b08bf53e230","repo":"keras-team/keras","slug":"cannot-do-batch-dot-on-inputs-with-different-batch","errorCode":null,"errorMessage":"Cannot do batch_dot on inputs with different batch sizes. Received inputs with shapes {x_shape} and {y_shape}.","messagePattern":"Cannot do batch_dot on inputs with different batch sizes\\. Received inputs with shapes (.+?) and (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/merging/dot.py","lineNumber":72,"sourceCode":"    y_shape = y.shape\n\n    x_ndim = len(x_shape)\n    y_ndim = len(y_shape)\n\n    if x_ndim < 2 or y_ndim < 2:\n        raise ValueError(\n            f\"Cannot do batch_dot on inputs \"\n            f\"with rank < 2. \"\n            f\"Received inputs with shapes \"\n            f\"{x_shape} and {y_shape}.\"\n        )\n\n    x_batch_size = x_shape[0]\n    y_batch_size = y_shape[0]\n\n    if x_batch_size is not None and y_batch_size is not None:\n        if x_batch_size != y_batch_size:\n            raise ValueError(\n                f\"Cannot do batch_dot on inputs \"\n                f\"with different batch sizes. \"\n                f\"Received inputs with shapes \"\n                f\"{x_shape} and {y_shape}.\"\n            )\n    if isinstance(axes, int):\n        axes = [axes, axes]\n\n    if axes is None:\n        if y_ndim == 2:\n            axes = [x_ndim - 1, y_ndim - 1]\n        else:\n            axes = [x_ndim - 1, y_ndim - 2]\n\n    if any(isinstance(a, (list, tuple)) for a in axes):\n        raise ValueError(\n            f\"Multiple target dimensions are not supported. \"\n            f\"Expected: None, int, (int, int), \"","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/merging/dot.py#L54-L90","documentation":"Error \"Cannot do batch_dot on inputs with different batch sizes. Received inputs with shapes {x_shape} and {y_shape}.\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/layers/merging/dot.py:72 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"}