The functional model is the more widely used of the two models. The key aspects of such a model are as follows:
- Multi-input, multi-output, and arbitrary static graph topologiesÂ
- Multi-input and multi-output models
- The complex model, which forks into two or more branchesÂ
- Models with shared layers
The functional API allows you to create models that are much more versatile as you can easily identify models that link layers to more than just the previous and next layers. You can actually connect layers to any other layer and create your own complex layer.
The following steps are similar to the sequential model's implementation, but with a number of changes. Here, we'll import the model, work on its architecture, and then train the network:
In[1]: import tensorflow as tf
In[2]: from tensorflow import keras
In[3]: from tensorflow.keras import layers
In[4]: inputs = keras.Input(shape=(10,))
In[5]: x= layers.Dense(20, activation='relu')(x)
In[6...