在定义网络时,pythorch会自己初始化参数,但也可以自己初始化,详见官方实现

for m in self.modules():
        if isinstance(m, nn.Conv2d):
            nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu')
        elif isinstance(m, (nn.BatchNorm2d, nn.GroupNorm)):
            nn.init.constant_(m.weight, 1)
            nn.init.constant_(m.bias, 0)

相关文章:

  • 2021-11-01
  • 2021-10-05
  • 2021-07-13
  • 2021-08-25
  • 2022-12-23
  • 2021-09-19
  • 2022-12-23
  • 2021-10-05
猜你喜欢
  • 2022-12-23
  • 2021-11-08
  • 2022-12-23
  • 2022-01-16
  • 2022-01-07
  • 2021-09-22
  • 2021-06-09
相关资源
相似解决方案