class_docstr: ISONet, a modified ResNet model.
class_docstr_tok: ["ISONet",",","a","modified","ResNet","model","."]
code: def _network_init(self, use_dirac=True):
      for m in self.modules():
          if isinstance(m, nn.Conv2d):
              if use_dirac:
                  # the first 7x7 convolution we use pytorch default initialization
                  # and not enforce orthogonality since the large input/output channel difference
                  if m.kernel_size != (7, 7):
                      nn.init.dirac_(m.weight)
              else:
                  # kaiming initialization used for ResNet results
                  fan_out = (
                      m.kernel_size[0]
                      * m.kernel_size[1]
                      * m.out_channels
                  )
                  m.weight.data.normal_(
                      mean=0.0, std=np.sqrt(2.0 / fan_out)
                  )
              if hasattr(m, "bias") and m.bias is not None:
                  nn.init.zeros_(m.bias)
          elif isinstance(m, nn.BatchNorm2d):
              zero_init_gamma = hasattr(m, "final_bn") and m.final_bn
              m.weight.data.fill_(0.0 if zero_init_gamma else 1.0)
              m.bias.data.zero_()
  
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 3 for calling the ISONet obj's underlying member method code with example usage: obj._network_init(use_dirac) without return types