Hi @ptrblck !
Where in the programme should I add weights_init()
function that you’ve defined ? Just after calling my model class ?
e.g
If I have a class Net() with my Network architecture, then In the main part I can do the following ?
model = Net()
def weights_init(m):
if isinstance(m, nn.Conv2d):
xavier(m.weight.data)
xavier(m.bias.data)
model.apply(weights_init)
optimizer=...
criterion=...
# Then the training Loop...
Is it a good way to initialize weight, then train my model ?
Thanks