keras-team/keras · error · ValueError
Undefined shapes are not supported.
Error message
Undefined shapes are not supported.
What it means
Error "Undefined shapes are not supported." thrown in keras-team/keras.
Source
Thrown at keras/src/backend/common/variables.py:594
dtype = dtypes.PYTHON_DTYPES_MAP.get(dtype, dtype)
if hasattr(dtype, "name"):
dtype = dtype.name
elif hasattr(dtype, "__name__"):
dtype = dtype.__name__
elif hasattr(dtype, "__str__") and (
"torch" in str(dtype) or "jax.numpy" in str(dtype)
):
dtype = str(dtype).split(".")[-1]
if dtype not in dtypes.ALLOWED_DTYPES:
raise ValueError(f"Invalid dtype: {dtype}")
return dtype
def standardize_shape(shape):
if not isinstance(shape, tuple):
if shape is None:
raise ValueError("Undefined shapes are not supported.")
if not hasattr(shape, "__iter__"):
raise ValueError(f"Cannot convert '{shape}' to a shape.")
if config.backend() == "tensorflow":
if isinstance(shape, tf.TensorShape):
# `tf.TensorShape` may contain `Dimension` objects.
# We need to convert the items in it to either int or `None`
shape = shape.as_list()
if config.backend() == "jax":
# Replace `_DimExpr` (dimension expression) with None
from jax import export as jax_export
shape = tuple(
None if jax_export.is_symbolic_dim(d) else d for d in shape
)
if config.backend() == "torch":
# Replace symbolic dimensions with None to preserve dynamic shapesView on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/backend/common/variables.py:594 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/09376756caeb577b.
Report an issue: GitHub.