keras-team/keras · error · ValueError

Input should have its last 2 dimensions fully-defined. Recei

Error message

Input should have its last 2 dimensions fully-defined. Received: input.shape = {x.shape}

What it means

Error "Input should have its last 2 dimensions fully-defined. Received: input.shape = {x.shape}" thrown in keras-team/keras.

Source

Thrown at keras/src/ops/linalg.py:422

        super().__init__(name=name)
        if mode not in {"reduced", "complete"}:
            raise ValueError(
                "`mode` argument value not supported. "
                "Expected one of {'reduced', 'complete'}. "
                f"Received: mode={mode}"
            )
        self.mode = mode

    def compute_output_spec(self, x):
        if len(x.shape) < 2:
            raise ValueError(
                "Input should have rank >= 2. Received: "
                f"input.shape = {x.shape}"
            )
        m = x.shape[-2]
        n = x.shape[-1]
        if m is None or n is None:
            raise ValueError(
                "Input should have its last 2 dimensions "
                "fully-defined. Received: "
                f"input.shape = {x.shape}"
            )
        k = min(m, n)
        base = tuple(x.shape[:-2])
        if self.mode == "reduced":
            return (
                KerasTensor(shape=base + (m, k), dtype=x.dtype),
                KerasTensor(shape=base + (k, n), dtype=x.dtype),
            )
        # 'complete' mode.
        return (
            KerasTensor(shape=base + (m, m), dtype=x.dtype),
            KerasTensor(shape=base + (m, n), dtype=x.dtype),
        )

    def call(self, x):

View on GitHub (pinned to 7a34a03db6)

When it happens

Trigger: Thrown at keras/src/ops/linalg.py:422 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/7f3eabf646a2bbc6. Report an issue: GitHub.