functionality that it offers. You will also take a look at using the back end, which is
TensorFlow in this case, to perform low-level operations all using Keras.
that does all of the work, and Keras is the rest of the car, including the software that
intricacies of a framework like TensorFlow. You only need to write a few lines of code
to have a deep learning model ready to train and ready to use. In contrast, TensorFlow
functionality to define the extra work that Keras abstracts away for you. At the same
time, TensorFlow and PyTorch also allow for much more flexibility if you know what
you’re doing.
320
TensorFlow and PyTorch allow you to manipulate individual
tensors (similar to
matrices, but they aren’t limited to two dimensions; they can range from vectors to
matrices to n-dimensional objects) to create custom neural network layers, and to create
new neural network architectures that include custom layers.
With that being said, Keras allows you to do the same things as TensorFlow and
PyTorch do, but you will have to import the back end itself (which in this case is
TensorFlow) to perform any of the low-level operations. This is basically the same thing
as working with TensorFlow itself since you’re using the TensorFlow syntax through
Keras, so you still need to be knowledgeable about TensorFlow syntax and functionality.
In the end, if you’re not doing research work that requires you to create a new type
of model, or to manipulate the tensors directly, simply use Keras. It’s a much easier
framework to use for beginners, and it will go a long way until you become sufficiently
advanced enough that you need the low-level functionality that TensorFlow or PyTorch
offers. And even then, you can still use TensorFlow (or whatever back end you’re using)
through Keras if you need to do any low-level work. One thing to note is that Keras has
actually been integrated into TensorFlow, so you can access Keras through TensorFlow
itself, but for the purpose of this appendix, we will use the Keras API to showcase the
Keras functionality, and the TensorFlow back end through Keras to demonstrate the low-
level operations that are analogous to PyTorch.
Using Keras
When using Keras, you will most likely import the necessary packages, load the data,
process it, and then pass it into the model. In this section, we will cover model creation
in Keras, the different layers available, several submodules of Keras, and how to use the
back end to perform tensor operations.
If you’d like to learn Keras even more in depth, feel free to check out the official
documentation. We only cover the basic essentials that you need to know about Keras, so
if you have further questions or would like to learn more, we recommend you to explore
the documentation.
For details on implementation, Keras is available on GitHub at
https://github.
com/keras-team/keras/tree/c2e36f369b411ad1d0a40ac096fe35f73b9dffd3
.
The official documentation is available at
https://keras.io/
.
Appendix A intro to KerAs