keras-team/keras · error · TypeError
`overwrite_with_gradient` must be a boolean. Received: {valu
Error message
`overwrite_with_gradient` must be a boolean. Received: {value} What it means
Error "`overwrite_with_gradient` must be a boolean. Received: {value}" thrown in keras-team/keras.
Source
Thrown at keras/src/backend/common/variables.py:365
return self._path
@property
def overwrite_with_gradient(self):
"""Whether this variable should be overwritten by the gradient.
This property is designed for a special case where we want to overwrite
the variable directly with its computed gradient. For example, in float8
training, new `scale` and `amax_history` are computed as gradients, and
we want to overwrite them directly instead of following the typical
procedure such as gradient descent with a learning rate, gradient
clipping and weight decaying.
"""
return self._overwrite_with_gradient
@overwrite_with_gradient.setter
def overwrite_with_gradient(self, value):
if not isinstance(value, bool):
raise TypeError(
"`overwrite_with_gradient` must be a boolean. "
f"Received: {value}"
)
self._overwrite_with_gradient = value
@property
def regularizer(self):
return self._regularizer
@regularizer.setter
def regularizer(self, value):
if value is not None and not callable(value):
raise ValueError(
"Invalid value for attribute `regularizer`. Expected a "
"callable (such as a `keras.regularizers.Regularizer` "
f"instance) or `None`. Received: regularizer={value}"
)
self._regularizer = valueView on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/backend/common/variables.py:365 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/10fe77d0bf28f25d.
Report an issue: GitHub.