Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Introduction to Deep Learning with PyTorch

Cursus bekijken

Oefeninstructies

  • For each layer (layer0 and layer1), use the uniform initialization method to initialize the weights.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

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)
Code bewerken en uitvoeren