code: def initialize_weights(opts, modules) -> None:
      """Helper function to initialize differnet layers in a model"""
      # weight initialization
      conv_init_type = getattr(
          opts, "model.layer.conv_init", "kaiming_normal"
      )
      linear_init_type = getattr(
          opts, "model.layer.linear_init", "normal"
      )
  
      conv_std = getattr(opts, "model.layer.conv_init_std_dev", None)
      linear_std = getattr(
          opts, "model.layer.linear_init_std_dev", 0.01
      )
      group_linear_std = getattr(
          opts, "model.layer.group_linear_init_std_dev", 0.01
      )
  
      if isinstance(modules, nn.Sequential):
          for m in modules:
              if isinstance(m, (nn.Conv2d, nn.Conv3d)):
                  initialize_conv_layer(
                      module=m,
                      init_method=conv_init_type,
                      std_val=conv_std,
                  )
              elif isinstance(m, norm_layers_tuple):
                  initialize_norm_layers(module=m)
              elif isinstance(m, (nn.Linear, LinearLayer)):
                  initialize_fc_layer(
                      module=m,
                      init_method=linear_init_type,
                      std_val=linear_std,
                  )
              elif isinstance(m, GroupLinear):
                  initialize_fc_layer(
                      module=m,
                      init_method=linear_init_type,
                      std_val=group_linear_std,
                  )
      else:
          if isinstance(modules, (nn.Conv2d, nn.Conv3d)):
              initialize_conv_layer(
                  module=modules,
                  init_method=conv_init_type,
                  std_val=conv_std,
              )
          elif isinstance(modules, norm_layers_tuple):
              initialize_norm_layers(module=modules)
          elif isinstance(modules, (nn.Linear, LinearLayer)):
              initialize_fc_layer(
                  module=modules,
                  init_method=linear_init_type,
                  std_val=linear_std,
              )
          elif isinstance(modules, GroupLinear):
              initialize_fc_layer(
                  module=modules,
                  init_method=linear_init_type,
                  std_val=group_linear_std,
              )
  
file_path: ml-cvnets/cvnets/misc/init_utils.py
imports: from typing import Optional
  from torch import nn
  from cvnets.layers import GroupLinear, LinearLayer, norm_layers_tuple
  from utils import logger
label_desc: Use image node_id 5 for calling a global function with example usage: initialize_weights(opts, modules) without return types