Training neural networks efficiently with high-level TensorFlow APIs
In this section, we will take a look at two high-level TensorFlow APIs—the Layers API (tensorflow.layers
or tf.layers
) and the Keras API (tensorflow.contrib.keras
).
Keras can be installed as a separate package. It supports Theano or TensorFlow as backend (for more information, refer to the official website of Keras at https://keras.io/).
However, after the release of TensorFlow 1.1.0, Keras has been added to the TensorFlow contrib
submodule. It is very likely that the Keras subpackage will be moved outside the experimental contrib
submodule and become one of the main TensorFlow submodules soon.
Building multilayer neural networks using TensorFlow's Layers API
To see what neural network training via the tensorflow.layers
(tf.layers
) high-level API looks like, let's implement a multilayer perceptron to classify the handwritten digits from the MNIST dataset, which we introduced in the previous chapter. The MNIST...