IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Introduction to Deep Learning with PyTorch

Visualizza il corso

Istruzioni dell'esercizio

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

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

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)
Modifica ed esegui il codice