keras-team/keras · error · ValueError
Incompatible input shapes: axis values {shape1[axes[0]]} (at
Error message
Incompatible input shapes: axis values {shape1[axes[0]]} (at axis {axes[0]}) != {shape2[axes[1]]} (at axis {axes[1]}). Full input shapes: {shape1}, {shape2} What it means
Error "Incompatible input shapes: axis values {shape1[axes[0]]} (at axis {axes[0]}) != {shape2[axes[1]]} (at axis {axes[1]}). Full input shapes: {shape1}, {shape2}" thrown in keras-team/keras.
Source
Thrown at keras/src/layers/merging/dot.py:287
or len(input_shape) != 2
):
raise ValueError(
f"A `Dot` layer should be called on a list of 2 inputs. "
f"Received: input_shape={input_shape}"
)
shape1 = input_shape[0]
shape2 = input_shape[1]
if shape1 is None or shape2 is None:
return
if isinstance(self.axes, int):
if self.axes < 0:
axes = [self.axes % len(shape1), self.axes % len(shape2)]
else:
axes = [self.axes] * 2
else:
axes = self.axes
if shape1[axes[0]] != shape2[axes[1]]:
raise ValueError(
f"Incompatible input shapes: "
f"axis values {shape1[axes[0]]} (at axis {axes[0]}) != "
f"{shape2[axes[1]]} (at axis {axes[1]}). "
f"Full input shapes: {shape1}, {shape2}"
)
def _merge_function(self, inputs):
if len(inputs) != 2:
raise ValueError(
f"A `Dot` layer should be called on exactly 2 inputs. "
f"Received: inputs={inputs}"
)
x1 = inputs[0]
x2 = inputs[1]
if isinstance(self.axes, int):
if self.axes < 0:
axes = [View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/layers/merging/dot.py:287 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/8e1f20df573d68f9.
Report an issue: GitHub.