Hi,
I have been following this example https://rstudio.github.io/keras/articles/examples/stateful_lstm.html.
When model training was in process, I forcefully stopped execution. And thereafter no matter how many times i tried to retrain the model I keep getting this error.
Even after removing model variable from the environment/ completely removing all objects from environment the following error persisted.
Error in py_call_impl(callable, dots$args, dots$keywords) :
ValueError: Initializer for variable lstm_7/Variable/ is from inside a control-flow construct, such as a loop or conditional. When creating a variable inside a loop or conditional, use a lambda as the initializer.
Detailed traceback:
File "E:ANACON~1envsR-TENS~1libsite-packageskerasmodels.py", line 436, in add
layer(x)
File "E:ANACON~1envsR-TENS~1libsite-packageskeraslayersrecurrent.py", line 262, in __call__
return super(Recurrent, self).__call__(inputs, **kwargs)
File "E:ANACON~1envsR-TENS~1libsite-packageskerasenginetopology.py", line 569, in __call__
self.build(input_shapes[0])
File "E:ANACON~1envsR-TENS~1libsite-packageskeraslayersrecurrent.py", line 1015, in build
self.reset_states()
File "E:ANACON~1envsR-TENS~1libsite-packageskeraslayersrecurrent.py", line 385, in reset_states
for _ in self.states]
File "E:ANACON~1envsR-TENS~1libsite-packageskeraslayersrecurrent.py", line 385, in
I have a feeling that you might need to clear the session before retraining, you can do that as described here: https://keras.io/backend/#clear_session
K <- backend()
K$clear_session()
Most helpful comment
I have a feeling that you might need to clear the session before retraining, you can do that as described here: https://keras.io/backend/#clear_session