Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the difference between "import keras" and "import tensorflow.keras"

I was wondering, what's the difference between importing keras from tensorflow using import tensorflow.keras or just pip installing keras alone and importing it using import keras as both seemed to work nicely so far, the only difference I noticed is that i get Using TensorFlow backend. in the command line every time I execute the one using keras.

like image 424
Glen E. Renner Avatar asked Dec 14 '22 12:12

Glen E. Renner


1 Answers

Tensorflow.keras is an version of Keras API implemented specifically for use with Tensorflow. It is a part of Tensorflow repo and from TF version 2.0 will become main high level API replacing tf.layers and slim.

The only reason to use standalone keras is to maintain framework-agnostic code, i.e. use it with another backend.

like image 144
Sharky Avatar answered May 17 '23 08:05

Sharky