code: def get_params_groups(
      model: torch.nn.Module, weight_decay: float = 1e-4
  ):
      params_group = [
          {"params": [], "weight_decay": 0.0},  # no decay
          {"params": [], "weight_decay": weight_decay},
      ]  # with decay
  
      for name, param in model.named_parameters():
          if not param.requires_grad:
              continue  # frozen weights
  
          if len(param.shape) == 1 or name.endswith(".bias"):
              # bn:(weight,bias)  conv2d:(bias)  linear:(bias)
              params_group[0]["params"].append(param)  # no decay
          else:
              params_group[1]["params"].append(param)  # with decay
  
      return params_group
  
file_path: deep-learning-for-image-processing/pytorch_segmentation/u2net/train_utils/train_and_eval.py
imports: import math
  import torch
  from torch.nn import functional
  import train_utils.distributed_utils
label_desc: Use image node_id 5 for calling a global function with example usage: get_params_groups(model, weight_decay) and returns: params_group