code: def init_weights(module):
      """
      Helper function to init weights for a given block.
      Inspired by classy_vision.models.regnet.RegNet.init_weights
      """
      num_initialized = 0
      for m in module.modules():
          if isinstance(m, nn.Conv2d):
              # Note that there is no bias due to BN
              fan_out = (
                  m.kernel_size[0] * m.kernel_size[1] * m.out_channels
              )
              m.weight.data.normal_(
                  mean=0.0, std=math.sqrt(2.0 / fan_out)
              )
              num_initialized += 1
          elif isinstance(m, nn.BatchNorm2d):
              m.weight.data.fill_(1.0)
              m.bias.data.zero_()
              num_initialized += 1
          elif isinstance(m, nn.Linear):
              m.weight.data.normal_(mean=0.0, std=0.01)
              m.bias.data.zero_()
              num_initialized += 1
      assert num_initialized > 0, (
          "Detecting bugs where we call init_weights in the wrong place "
          "and not end up finding any modules to init"
      )
  
imports: import math
  from collections import OrderedDict
  from typing import List, Tuple, Union
  import torch
  import torch.nn
  from classy_vision.generic.util import get_torch_version
  from classy_vision.models.anynet import ActivationType, AnyNetParams, BlockType, ResBasicBlock, ResBottleneckBlock, ResBottleneckLinearBlock, ResStemCifar, ResStemIN, SimpleStemIN, StemType, VanillaBlock
  from classy_vision.models.regnet import RegNetParams
  from fairscale.nn import checkpoint_wrapper
  from vissl.config import AttrDict
  from vissl.data.collators.collator_helper import MultiDimensionalTensor
  from vissl.models.model_helpers import Flatten, get_trunk_forward_outputs, get_tunk_forward_interpolated_outputs, transform_model_input_data_type
  from vissl.models.trunks import register_model_trunk
  from vissl.utils.fsdp_utils import auto_wrap_big_layers, fsdp_auto_wrap_bn, fsdp_wrapper
  from vissl.utils.misc import set_torch_seed
label_desc: Use image node_id 1 for calling a global function with example usage: init_weights(module) without return types