class FaceBox_s(nn.Module):
def init_params(self):
for m in self.modules():
if isinstance(m, nn.Conv2d):
nn.init.xavier_uniform_(m.weight)
if m.bias is not None:
nn.init.constant_(m.bias, 0)
elif isinstance(m, nn.BatchNorm2d):
nn.init.constant_(m.weight, 1)
nn.init.constant_(m.bias, 0)
elif isinstance(m, nn.Linear):
nn.init.normal_(m.weight, std=0.001)
if m.bias is not None:
nn.init.constant_(m.bias, 0)
pytorch 初始化权重_AI视觉网奇的博客-CSDN博客
初始化参数为0:
def init_params(self):
for m in self.modules():
if isinstance(m, nn.Conv2d):
nn.init.constant_(m.weight, 0)
# nn.init.xavier_uniform_(m.weight)
if m.bias is not None:
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://blog.csdn.net/jacke121/article/details/124391335
内容来源于网络,如有侵权,请联系作者删除!