import tensorflow as tf import tensorflow from tensorflow import keras from keras.layers import Dense
I am getting the below error
from keras.layers import Input, Dense Traceback (most recent call last): File "<ipython-input-6-b5da44e251a5>", line 1, in <module> from keras.layers import Input, Dense ModuleNotFoundError: No module named 'keras'
How do I solve this?
Note: I am using Tensorflow version 1.4
The difference between tf. keras and keras is the Tensorflow specific enhancement to the framework. keras is an API specification that describes how a Deep Learning framework should implement certain part, related to the model definition and training.
Use the keras module from tensorflow like this:
import tensorflow as tf
Import classes
from tensorflow.python.keras.layers import Input, Dense
or use directly
dense = tf.keras.layers.Dense(...)
EDIT Tensorflow 2
from tensorflow.keras.layers import Input, Dense
and the rest stays the same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With