{"record":{"id":"09376756caeb577b","repo":"keras-team/keras","slug":"undefined-shapes-are-not-supported","errorCode":null,"errorMessage":"Undefined shapes are not supported.","messagePattern":"Undefined shapes are not supported\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/common/variables.py","lineNumber":594,"sourceCode":"    dtype = dtypes.PYTHON_DTYPES_MAP.get(dtype, dtype)\n    if hasattr(dtype, \"name\"):\n        dtype = dtype.name\n    elif hasattr(dtype, \"__name__\"):\n        dtype = dtype.__name__\n    elif hasattr(dtype, \"__str__\") and (\n        \"torch\" in str(dtype) or \"jax.numpy\" in str(dtype)\n    ):\n        dtype = str(dtype).split(\".\")[-1]\n\n    if dtype not in dtypes.ALLOWED_DTYPES:\n        raise ValueError(f\"Invalid dtype: {dtype}\")\n    return dtype\n\n\ndef standardize_shape(shape):\n    if not isinstance(shape, tuple):\n        if shape is None:\n            raise ValueError(\"Undefined shapes are not supported.\")\n        if not hasattr(shape, \"__iter__\"):\n            raise ValueError(f\"Cannot convert '{shape}' to a shape.\")\n        if config.backend() == \"tensorflow\":\n            if isinstance(shape, tf.TensorShape):\n                # `tf.TensorShape` may contain `Dimension` objects.\n                # We need to convert the items in it to either int or `None`\n                shape = shape.as_list()\n\n    if config.backend() == \"jax\":\n        # Replace `_DimExpr` (dimension expression) with None\n        from jax import export as jax_export\n\n        shape = tuple(\n            None if jax_export.is_symbolic_dim(d) else d for d in shape\n        )\n\n    if config.backend() == \"torch\":\n        # Replace symbolic dimensions with None to preserve dynamic shapes","sourceCodeStart":576,"sourceCodeEnd":612,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/common/variables.py#L576-L612","documentation":"Error \"Undefined shapes are not supported.\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/common/variables.py:594 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}