{"record":{"id":"7f3eabf646a2bbc6","repo":"keras-team/keras","slug":"input-should-have-its-last-2-dimensions-fully-defi","errorCode":null,"errorMessage":"Input should have its last 2 dimensions fully-defined. Received: input.shape = {x.shape}","messagePattern":"Input should have its last 2 dimensions fully-defined\\. Received: input\\.shape = (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/ops/linalg.py","lineNumber":422,"sourceCode":"        super().__init__(name=name)\n        if mode not in {\"reduced\", \"complete\"}:\n            raise ValueError(\n                \"`mode` argument value not supported. \"\n                \"Expected one of {'reduced', 'complete'}. \"\n                f\"Received: mode={mode}\"\n            )\n        self.mode = mode\n\n    def compute_output_spec(self, x):\n        if len(x.shape) < 2:\n            raise ValueError(\n                \"Input should have rank >= 2. Received: \"\n                f\"input.shape = {x.shape}\"\n            )\n        m = x.shape[-2]\n        n = x.shape[-1]\n        if m is None or n is None:\n            raise ValueError(\n                \"Input should have its last 2 dimensions \"\n                \"fully-defined. Received: \"\n                f\"input.shape = {x.shape}\"\n            )\n        k = min(m, n)\n        base = tuple(x.shape[:-2])\n        if self.mode == \"reduced\":\n            return (\n                KerasTensor(shape=base + (m, k), dtype=x.dtype),\n                KerasTensor(shape=base + (k, n), dtype=x.dtype),\n            )\n        # 'complete' mode.\n        return (\n            KerasTensor(shape=base + (m, m), dtype=x.dtype),\n            KerasTensor(shape=base + (m, n), dtype=x.dtype),\n        )\n\n    def call(self, x):","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/ops/linalg.py#L404-L440","documentation":"Qr.compute_output_spec needs the last two dimensions (m, n) statically defined to compute the output shapes of Q and R. Unknown (None) trailing dims raise this ValueError; provide a fully specified input shape.","triggerScenarios":"Thrown at keras/src/ops/linalg.py:422 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Build the model with fully-defined matrix dimensions for QR inputs","Specify the input shape explicitly (e.g. Input(shape=(m, n)))"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}