keras-team/keras · error · ValueError
Unknown `floatx` value
Error message
Unknown `floatx` value: {value}. Expected one of {accepted_dtypes} What it means
Raised by keras.config.set_floatx when the value is not in {'bfloat16','float16','float32','float64'}. The global floatx dtype governs default variable/layer creation, so only these four strings are accepted by this guard.
Solutions
- Call set_floatx with 'float16', 'float32', 'float64', or 'bfloat16'.
- Check for typos and aliases: 'Float32' and 'fp32' are rejected; use exact lowercase strings.
- Reset with keras.config.set_floatx('float32') to restore the default.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at keras/src/backend/config.py:78 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/731a38c79a9c5488.
Report an issue: GitHub.
Appendix: source
Thrown at keras/src/backend/config.py:78
Examples:
>>> keras.config.floatx()
'float32'
>>> keras.config.set_floatx('float64')
>>> keras.config.floatx()
'float64'
>>> # Set it back to float32
>>> keras.config.set_floatx('float32')
Raises:
ValueError: In case of invalid value.
"""
global _FLOATX
accepted_dtypes = {"bfloat16", "float16", "float32", "float64"}
if value not in accepted_dtypes:
raise ValueError(
f"Unknown `floatx` value: {value}. "
f"Expected one of {accepted_dtypes}"
)
_FLOATX = str(value)
@keras_export(["keras.config.epsilon", "keras.backend.epsilon"])
def epsilon():
"""Return the value of the fuzz factor used in numeric expressions.
Returns:
A float.
Example:
>>> keras.config.epsilon()
1e-07
View on GitHub (pinned to 7a34a03db6)