keras-team/keras · error · TypeError
Invalid type for argument `axes`: it should be a list or an
Error message
Invalid type for argument `axes`: it should be a list or an int. Received: axes={axes} What it means
Error "Invalid type for argument `axes`: it should be a list or an int. Received: axes={axes}" thrown in keras-team/keras.
Source
Thrown at keras/src/layers/merging/dot.py:246
corresponding to the desired axis from the first input and the
desired axis from the second input, respectively. Note that the
size of the two selected axes must match, and that
axis `0` (the batch axis) cannot be included.
normalize: Whether to L2-normalize samples along the dot product axis
before taking the dot product. If set to `True`, then
the output of the dot product is the cosine proximity
between the two samples.
**kwargs: Standard layer keyword arguments.
Returns:
A tensor, the dot product of the samples from the inputs.
"""
def __init__(self, axes, normalize=False, **kwargs):
super().__init__(**kwargs)
if not isinstance(axes, int):
if not isinstance(axes, (list, tuple)):
raise TypeError(
f"Invalid type for argument `axes`: it should be "
f"a list or an int. Received: axes={axes}"
)
if len(axes) != 2:
raise ValueError(
f"Invalid format for argument `axes`: it should contain "
f"two elements. Received: axes={axes}"
)
if not isinstance(axes[0], int) or not isinstance(axes[1], int):
raise ValueError(
f"Invalid format for argument `axes`: list elements should "
f"be integers. Received: axes={axes}"
)
self.axes = axes
self.normalize = normalize
self.supports_masking = True
self._reshape_required = False
View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/layers/merging/dot.py:246 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/0871b744fd2ef668.
Report an issue: GitHub.