PSMNet icon indicating copy to clipboard operation
PSMNet copied to clipboard

m.weight.data.normal_(0, math.sqrt(2. / n)) what does it mean?

Open zhang405744522 opened this issue 6 years ago • 5 comments

zhang405744522 avatar Jan 04 '19 07:01 zhang405744522

@zhang405744522 It is weight initialization. Please refer to Kaiming He 2015 paper

JiaRenChang avatar Jan 04 '19 08:01 JiaRenChang

thanks for your response so fast.
I also got the papaer <Understanding the difficulty of training deep feedforward neural networks>

zhang405744522 avatar Jan 04 '19 08:01 zhang405744522

Understanding the difficulty of training deep feedforward neural networks

zhang405744522 avatar Jan 04 '19 08:01 zhang405744522

Can anyone please tell me , how can I initialize it in keras

niraj2477 avatar Jun 16 '22 08:06 niraj2477

    for m in self.modules():
        if isinstance(m, nn.Conv2d):
            n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
            m.weight.data.normal_(0, math.sqrt(2. / n))
        elif isinstance(m, nn.BatchNorm2d):
            m.weight.data.fill_(1)
            m.bias.data.zero_()

zgh1349786296 avatar Sep 22 '22 03:09 zgh1349786296