ValueError: ('`tf.compat.v1.keras` Optimizer is not supported when eager execution is enabled. Use a `tf.keras` Optimizer instead, or disable eager execution.')
ValueError: ('`tf.compat.v1.keras` Optimizer (', <tensorflow.python.keras.optimizers.SGD >, ') is not supported when eager execution is enabled. Use a `tf.keras` Optimizer instead, or disable eager execution.')
ValueError: ('`tf.compat.v1.keras` Optimizer (', <tensorflow.python.keras.optimizers.SGD object at 0x7ff814173dc0>, ') is not supported when eager execution is enabled. Use a `tf.keras` Optimizer instead, or disable eager execution.')
Solution -
Modify,
from tensorflow.python.keras.optimizers import Adam
to
from tensorflow.keras.optimizers import Adam
Note : Also kindly import other libraries from tensorflow.keras
instead of tensorflow.python.keras
.