A simple MLP
Now that you have all of the basic building blocks, it's time to build a simple multi-layer perceptron (MLP). In this exercise, you are to build a 2-layer MLP for a regression problem.
- Implement the MLP. It should take as input a vector
xand a list of weight matrices and bias vectors. The first layer should be an affine transformation followed by a ReLU activation and the second layer should be another affine transformation. - Implement a loss function that computes the mean-squared error.
- Implement a
jit'ed training step, as in the previous exercise. - Implement a training loop that runs for 1000 steps. Plot the loss as a function of the training step. It should be decreasing.