The Model class
It is very beneficial in alliancing the layers into an object that encompasses features like training and inference.
Following are the two ways by which the models can be instantiated:
I. In the first way, we will do with the help of "Functional API". We will start with the Input followed by connecting the layer calls for specifying the forward pass of the model and thus end by creating the model by utilizing the inputs as well as outputs.
II. In the second way we will do by subclassing the Model class. Here first we will define layers in _init_ followed by executing the forward pass of the model in the call.
While subclassing the Model, we can also have a training argument called Boolean (which is optional) in the call for specifying distinct behavior in inference as well as training:
After creating the model, we can config the model by incorporating losses and metrics by model.compile(). The model can be trained by using the model.fit() and with the help of model.predict() the model can make the predictions.
It can be used to print out the network's summary in the form of a string.
It helps in the retrieval of a layer either on the basis of its unique name or index. The index will take precedence in case if both the name as well as index are already provided, such that the indices rely on the bottom-up approach (horizontal traversal graph).
It outputs an instance of the layer.