keras-team/keras · error · ValueError
Input should have rank >= 2. Received: input.shape = {x.shap
Error message
Input should have rank >= 2. Received: input.shape = {x.shape} What it means
Error "Input should have rank >= 2. Received: input.shape = {x.shape}" thrown in keras-team/keras.
Source
Thrown at keras/src/ops/linalg.py:415
return Norm(ord=ord, axis=axis, keepdims=keepdims).symbolic_call(x)
x = backend.convert_to_tensor(x)
return backend.linalg.norm(x, ord=ord, axis=axis, keepdims=keepdims)
class Qr(Operation):
def __init__(self, mode="reduced", *, name=None):
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),
)View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/ops/linalg.py:415 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/e409f618c9782f9b.
Report an issue: GitHub.