A quick tour of the Keras functional API
So far, we've used sequential models. In the sequential model, layers get stacked on top of each other when we call model.add()
. The advantage of the functional API is that it is simple and prevents errors. The disadvantage is that it only allows us to stack layers linearly:
Take a look at the preceding GoogLeNet architecture. While the graph is very detailed, what we need to take away is the fact that the model is not just a number of layers stacked on top of each other. Instead, there are multiple layers in parallel; in this case, the model has three outputs. However, the question remains, how did the authors build this complicated model? The sequential API wouldn't have allowed them to, but the functional API makes it easy to string up layers like a pearl string and create architectures such as the preceding one.
For many NLP applications, we need more complex models...