We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d18dd33 commit 51aa455Copy full SHA for 51aa455
keras/src/backend/common/variables.py
@@ -211,6 +211,12 @@ def __init__(
211
212
def _deferred_initialize(self):
213
if self._value is not None:
214
+ # If NNX is enabled, it's possible the variable was already
215
+ # initialized by a concrete call. In this case,
216
+ # _deferred_initialize becomes a no-op for this variable.
217
+ if config.is_nnx_enabled():
218
+ self._initializer = None # Clear initializer as it's now "used"
219
+ return
220
raise ValueError(f"Variable {self.path} is already initialized.")
221
222
if in_stateless_scope():
0 commit comments