Reputation: 395
I got the following error when I tried to run the code :
model = Sequential()
model.add(LSTM(4, input_shape=(1, look_back)))
TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'
I understood one of the solutions is to use another version of keras such as this link. But I'm using my company's desktop and every uninstall and install have to go through my company's IT department. Is there another workaround that does not involve changing the version of keras?
My keras version is v2.2.4; tensoflow is v1.1.0
Upvotes: 2
Views: 533
Reputation: 2679
There is a way, but it's not pretty. You could reach into TensorFlow internals and monkey-patch while_loop
to ignore maximum_iterations=
:
from tensorflow.python.ops import control_flow_ops
orig_while_loop = control_flow_ops.while_loop
def patched_while_loop(*args, **kwargs):
kwargs.pop("maximum_iterations", None) # Ignore.
return orig_while_loop(*args, **kwargs)
control_flow_ops.while_loop = patched_while_loop
Note that this is not bulletproof, i.e. it will fail if maximum_iterations
is given as a positional (as opposed to keyword) argument, but it should "fix" LSTM
in your case.
Upvotes: 3