code: def get_param_groups(model, cfg):
      def _get_layer_decay(name):
          layer_id = None
          if name in ("cls_token", "mask_token"):
              layer_id = 0
          elif name.startswith("pos_embed"):
              layer_id = 0
          elif name.startswith("patch_embed"):
              layer_id = 0
          elif name.startswith("blocks"):
              layer_id = int(name.split(".")[1]) + 1
          else:
              layer_id = cfg.MVIT.DEPTH + 1
          layer_decay = cfg.SOLVER.LAYER_DECAY ** (
              cfg.MVIT.DEPTH + 1 - layer_id
          )
          return layer_id, layer_decay
  
      for m in model.modules():
          assert not isinstance(
              m, torch.nn.modules.batchnorm._NormBase
          ), "BN is not supported with layer decay"
  
      non_bn_parameters_count = 0
      zero_parameters_count = 0
      no_grad_parameters_count = 0
      parameter_group_names = {}
      parameter_group_vars = {}
  
      skip = {}
      if cfg.NUM_GPUS > 1:
          if hasattr(model.module, "no_weight_decay"):
              skip = model.module.no_weight_decay()
              # skip = {"module." + v for v in skip}
      else:
          if hasattr(model, "no_weight_decay"):
              skip = model.no_weight_decay()
  
      for name, p in model.named_parameters():
          if not p.requires_grad:
              group_name = "no_grad"
              no_grad_parameters_count += 1
              continue
          name = (
              name[len("module.") :]
              if name.startswith("module.")
              else name
          )
          if name in skip or (
              (len(p.shape) == 1 or name.endswith(".bias"))
              and cfg.SOLVER.ZERO_WD_1D_PARAM
          ):
              layer_id, layer_decay = _get_layer_decay(name)
              group_name = "layer_%d_%s" % (layer_id, "zero")
              weight_decay = 0.0
              zero_parameters_count += 1
          else:
              layer_id, layer_decay = _get_layer_decay(name)
              group_name = "layer_%d_%s" % (layer_id, "non_bn")
              weight_decay = cfg.SOLVER.WEIGHT_DECAY
              non_bn_parameters_count += 1
  
          if group_name not in parameter_group_names:
              parameter_group_names[group_name] = {
                  "weight_decay": weight_decay,
                  "params": [],
                  "layer_decay": layer_decay,
              }
              parameter_group_vars[group_name] = {
                  "weight_decay": weight_decay,
                  "params": [],
                  "layer_decay": layer_decay,
              }
          parameter_group_names[group_name]["params"].append(name)
          parameter_group_vars[group_name]["params"].append(p)
  
      # print("Param groups = %s" % json.dumps(parameter_group_names, indent=2))
      optim_params = list(parameter_group_vars.values())
  
      # Check all parameters will be passed into optimizer.
      assert (
          len(list(model.parameters()))
          == non_bn_parameters_count
          + zero_parameters_count
          + no_grad_parameters_count
      ), "parameter size does not match: {} + {} + {} != {}".format(
          non_bn_parameters_count,
          zero_parameters_count,
          no_grad_parameters_count,
          len(list(model.parameters())),
      )
      print(
          "non bn {}, zero {}, no grad {}".format(
              non_bn_parameters_count,
              zero_parameters_count,
              no_grad_parameters_count,
          )
      )
  
      return optim_params
  
file_path: SlowFast/slowfast/models/optimizer.py
imports: import torch
  import slowfast.utils.lr_policy
label_desc: Use image node_id 2 for calling a global function with example usage: get_param_groups(model, cfg) and returns: optim_params, layer_id,  layer_decay