Hands-On Artificial Intelligence for Beginners
上QQ阅读APP看书,第一时间看更新

Basic building blocks

As Keras is designed as a model-level library, it does not contain methods for doing basic operations as PyTorch of base TensorFlow does. Instead, it utilizes TensorFlow as a backend. As such, its basic operations are the same as basic TensorFlow operations: 

import keras.backend as K
x = K.constant(5)
y = K.constant(6)
product = x * y

Keras also uses the same graph structure as Tensorflow. We'll learn more about Keras model building methods in the next chapter on Your First Artificial Neural Networks.