code: def check_trainable_parameters(
      model: torch.nn.Module, model_params: List
  ) -> None:
      """Helper function to check if any model parameters w/ gradients are not part of model_params"""
  
      # get model parameter names
      model_trainable_params = []
      for p_name, param in model.named_parameters():
          if param.requires_grad:
              model_trainable_params.append(p_name)
  
      initialized_params = []
      for param_info in model_params:
          if not isinstance(param_info, Dict):
              logger.error(
                  "Expected format is a Dict with three keys: params, weight_decay, param_names"
              )
  
          if not {"params", "weight_decay", "param_names"}.issubset(
              param_info.keys()
          ):
              logger.error(
                  "Parameter dict should have three keys: params, weight_decay, param_names"
              )
  
          param_names = param_info.pop("param_names")
          if isinstance(param_names, List):
              initialized_params.extend(param_names)
          elif isinstance(param_names, str):
              initialized_params.append(param_names)
          else:
              raise NotImplementedError
  
      uninitialized_params = set(model_trainable_params) ^ set(
          initialized_params
      )
      if len(uninitialized_params) > 0:
          logger.error(
              "Following parameters are defined in the model, but won't be part of optimizer. "
              "Please check get_trainable_parameters function. "
              "Use --optim.bypass-parameters-check flag to bypass this check. "
              "Parameter list = {}".format(uninitialized_params)
          )
  
file_path: ml-cvnets/optim/__init__.py
imports: import argparse
  from typing import Dict, List
  import torch.nn
  from optim.base_optim import BaseOptim
  from utils import logger
  from utils.common_utils import unwrap_model_fn
  from utils.registry import Registry
label_desc: Use image node_id 1 for calling a global function with example usage: check_trainable_parameters(model, model_params) without return types