It is known by math that the combination of several linear layers can still be seen as an linear layer, so we can add some non-linear activation functions, such as ReLU, in between to get better effect.
Multi-Layer Perceptron (MLP), is such a neural network composed of multiple fully connected layers with non-linear activations, commonly used in deep learning.
Please define a class called My_MLP_Model that subclasses nn.Module and works in the following ways:
The architecture consists of two hidden layers and one output layer.
Each hidden layer consists of an affine transformation module and a ReLU activiation module.
Each affine transformation module shall be initialized with the build-in class nn.Linear.
Each ReLU activiatio nmodule shall be initialized with your self-defined class My_ReLU.