I just upgraded my tf from 1.0 to tf 1.3 (pip install --upgrade tensorflow) . I know keras 2.0 became part of tensorflow since tf version 1.2. However, when I import keras and check its version it still shows 1.2. Am I supposed to upgrade keras also? if so, then what does "the Keras API will now become available directly as part of TensorFlow, starting with TensorFlow 1.2" mean?
6
votes
If you want to use keras in that way, don't import keras but use directly the api integrated in tf : tensorflow.org/api_docs/python/tf/contrib/keras
– Nassim Ben
I just installed Keras 2 and it works fine on a simple example. I still don't understand why I had to do that if Keras is now part of tensorflow (as tf v1.2)
– Kai
when you used keras with tensorflow, did you import it that way : from "tf.contrib import keras" ? If you want to use it through tensorflow, you have to use the library integrated in tensorflow... Which is located in tf.contrib.keras... Then you can use tf.contrib.keras.conv1D for example... which is a 1D convolutional layer
– Nassim Ben
1 Answers
3
votes
Nope, you don't need to install keras 2.0 separately. (See: https://www.tensorflow.org/guide/keras)
Do this:
import tensorflow as tf
model = tf.keras.Sequential()
Don't do this (Unless you really need framework independent code):
import keras
model = keras.Sequential()