Restructure the Keras class hierarchy for Network, Model and Sequential.
The intention of this change is to reduce the code complexity within Keras class, especially for Network, which currently contains logic for both subclass Model and functional Model. After this change, the subclass model and functional model become individual class and become self contained. 1. Model is now the base class for subclass model. It doesn't contains network structure management, and the topology will be created within __init__ and __call__, which is for user to implement. It also contains compile/fit/eval/predict, which is the basic functionality for model training. 2. Functional is created based on existing Network class. It extends the Model, which allows it leverage compile/fit/eval/predict. In addition, it also take input/output as init parameter and manage the network topology. 3. Sequential model is now a subclass of Functional, since it will use Functional's method to manage it topology (layer stacking). Model(input, output) will create a Functional under the hood, and behave the same way as before. PiperOrigin-RevId: 311232972
Showing
想要评论请 注册 或 登录