parameters: (model, patterns_list, lrs=None, momentums=None, weight_decays=None)
return_statement: return param_groups
docstring: Group parameters for using per-parameters option in optimizer
  
      Returns a list of dict that matches Pytorch optimizer fashion, see
      https://pytorch.org/docs/stable/optim.html#per-parameter-options for more details.
  
      Example:
          >>> [
          >>>    {'params': model.base.parameters()},
          >>>    {'params': model.classifier.parameters(), 'lr': 1e-3}
          >>> ]
      Parameters will be grouped w.r.t first level of the keys_list. e.g. `keys_list=[['conv1', 'conv2'], ['conv3']]` will
      return 2 groups, one with `conv1` and `conv2` in name, and the other with `conv3` in name.
  
      If lr, momentum or weight_decay are supplied, they will be added to the group as well.
  
  
      Args:
          model: A module
          patterns_list: A list of list of strings. WARNING: patters must be EXCLUSIVE, the function doesn't
              perform exclusive check.
          lrs: A list of float with same length as keys_list or None.
          momentums: A list of float with same length as keys_list or None.
          weight_decays: A list of float with same length as keys_list or None.
  
      Returns:
          param_group: A list of dict
docstring_summary: Group parameters for using per-parameters option in optimizer
docstring_tokens: Group parameters for using per - parameters option in optimizer
function: def group_parameters(model, patterns_list, lrs=None, momentums=None, weight_decays=None):
      """Group parameters for using per-parameters option in optimizer
  
      Returns a list of dict that matches Pytorch optimizer fashion, see
      https://pytorch.org/docs/stable/optim.html#per-parameter-options for more details.
  
      Example:
          >>> [
          >>>    {'params': model.base.parameters()},
          >>>    {'params': model.classifier.parameters(), 'lr': 1e-3}
          >>> ]
      Parameters will be grouped w.r.t first level of the keys_list. e.g. `keys_list=[['conv1', 'conv2'], ['conv3']]` will
      return 2 groups, one with `conv1` and `conv2` in name, and the other with `conv3` in name.
  
      If lr, momentum or weight_decay are supplied, they will be added to the group as well.
  
  
      Args:
          model: A module
          patterns_list: A list of list of strings. WARNING: patters must be EXCLUSIVE, the function doesn't
              perform exclusive check.
          lrs: A list of float with same length as keys_list or None.
          momentums: A list of float with same length as keys_list or None.
          weight_decays: A list of float with same length as keys_list or None.
  
      Returns:
          param_group: A list of dict
  
      """
      param_groups = []
      for pattern in patterns_list:
          if not isinstance(pattern, list):
              raise TypeError("patterns_list must be list of list of patterns")
          param_groups.append({'params': match_parameters(model, pattern)})
  
      if lrs is not None:
          if len(lrs) != len(patterns_list):
              raise TypeError("len(lrs) must match len(patterns_list)")
          for i, lr in enumerate(lrs):
              param_groups[i]['lr'] = lr
  
      if momentums is not None:
          if len(momentums) != len(patterns_list):
              raise TypeError("len(momentums) must match len(patterns_list)")
          for i, momentum in enumerate(momentums):
              param_groups[i]['momentum'] = momentum
  
      if weight_decays is not None:
          if len(weight_decays) != len(patterns_list):
              raise TypeError("len(weight_decays) must match len(patterns_list)")
          for i, weight_decay in enumerate(weight_decays):
              param_groups[i]['weight_decay'] = weight_decay
  
      return param_groups
function_tokens: def group_parameters ( model , patterns_list , lrs = None , momentums = None , weight_decays = None ) : param_groups = [ ] for pattern in patterns_list : if not isinstance ( pattern , list ) : raise TypeError ( "patterns_list must be list of list of patterns" ) param_groups . append ( { 'params' : match_parameters ( model , pattern ) } ) if lrs is not None : if len ( lrs ) != len ( patterns_list ) : raise TypeError ( "len(lrs) must match len(patterns_list)" ) for i , lr in enumerate ( lrs ) : param_groups [ i ] [ 'lr' ] = lr if momentums is not None : if len ( momentums ) != len ( patterns_list ) : raise TypeError ( "len(momentums) must match len(patterns_list)" ) for i , momentum in enumerate ( momentums ) : param_groups [ i ] [ 'momentum' ] = momentum if weight_decays is not None : if len ( weight_decays ) != len ( patterns_list ) : raise TypeError ( "len(weight_decays) must match len(patterns_list)" ) for i , weight_decay in enumerate ( weight_decays ) : param_groups [ i ] [ 'weight_decay' ] = weight_decay return param_groups