Layer initialization
The initialization of the weights of a neural network has been the focus of researchers for many years. When training a network, the method used to initialize the weights has a direct impact on the final performance of the network.
As a machine learning practitioner, you should be able to experiment with different initialization strategies. In this exercise, you are creating a small neural network made of two layers and you are deciding to initialize each layer's weights with the uniform method.
This exercise is part of the course
Introduction to Deep Learning with PyTorch
Exercise instructions
- For each layer (
layer0
andlayer1
), use the uniform initialization method to initialize the weights.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
layer0 = nn.Linear(16, 32)
layer1 = nn.Linear(32, 64)
# Use uniform initialization for layer0 and layer1 weights
nn.____.____(____)
nn.____.____(____)
model = nn.Sequential(layer0, layer1)