class_docstr: Base class for optimizers.
  
  This wraps a :class:`torch.optim.Optimizer` instance and provides support
  for parameter scheduling. Typical PyTorch optimizers are used like this:
  
      optim = SGD(model.parameters(), lr=0.1)
  
  but the user is responsible for updating lr over the course of training.
  ClassyOptimizers extend PyTorch optimizers and allow specifying
  ParamSchedulers instead:
  
      optim = SGD()
      optim.set_param_groups(model.parameters(), lr=LinearParamScheduler(1, 2))
  
  This means that as you step through the optimizer, the learning rate will
  automatically get updated with the given schedule. To access the current
  learning rate value (or any other optimizer option), you can read
  `optim.options_view.lr`. Similar to other Classy abstractions, you can also
  instantiate ClassyOptimizers from a configuration file.
class_docstr_tok: ["Base","class","for","optimizers",".","This","wraps","a",":","class",":","`","torch.optim.Optimizer","`","instance","and","provides","support","for","parameter","scheduling",".","Typical","PyTorch","optimizers","are","used","like","this",":","optim","=","SGD","(","model.parameters","(",")",",","lr=0.1",")","but","the","user","is","responsible","for","updating","lr","over","the","course","of","training",".","ClassyOptimizers","extend","PyTorch","optimizers","and","allow","specifying","ParamSchedulers","instead",":","optim","=","SGD","(",")","optim.set_param_groups","(","model.parameters","(",")",",","lr=LinearParamScheduler","(","1",",","2",")",")","This","means","that","as","you","step","through","the","optimizer",",","the","learning","rate","will","automatically","get","updated","with","the","given","schedule",".","To","access","the","current","learning","rate","value","(","or","any","other","optimizer","option",")",",","you","can","read","`","optim.options_view.lr","`",".","Similar","to","other","Classy","abstractions",",","you","can","also","instantiate","ClassyOptimizers","from","a","configuration","file","."]
docstr: Specifies what parameters will be optimized.
  
  This is the public API where users of ClassyOptimizer can specify what
  parameters will get optimized. Unlike PyTorch optimizers, we don't
  require the list of param_groups in the constructor.
  
  Args:
      param_groups: this is either a list of Tensors (e.g.
          model.parameters()) or a list of dictionaries. If a dictionary,
          must contain a key "params" having the same format and semantics as
          PyTorch.
docstr_tok: ["Specifies","what","parameters","will","be","optimized",".","This","is","the","public","API","where","users","of","ClassyOptimizer","can","specify","what","parameters","will","get","optimized",".","Unlike","PyTorch","optimizers",",","we","don't","require","the","list","of","param_groups","in","the","constructor",".","Args",":","param_groups",":","this","is","either","a","list","of","Tensors","(","e.g",".","model.parameters","(",")",")","or","a","list","of","dictionaries",".","If","a","dictionary",",","must","contain","a","key","``","params","''","having","the","same","format","and","semantics","as","PyTorch","."]
code: def set_param_groups(self, param_groups, **kwargs):
      """
      Specifies what parameters will be optimized.
  
      This is the public API where users of ClassyOptimizer can specify what
      parameters will get optimized. Unlike PyTorch optimizers, we don't
      require the list of param_groups in the constructor.
  
      Args:
          param_groups: this is either a list of Tensors (e.g.
              model.parameters()) or a list of dictionaries. If a dictionary,
              must contain a key "params" having the same format and semantics as
              PyTorch.
      """
  
      def cast_param_groups(params):
          """Converts a list/dict to the PyTorch param_groups format."""
  
          if params is None:
              return []
  
          if isinstance(params, dict):
              assert "params" in params
              return [params]
  
          pg = list(params)
          if len(pg) == 0:
              raise ValueError("optimizer got an empty parameter list")
          if not isinstance(pg[0], dict):
              pg = [{"params": pg}]
          return pg
  
      self._param_group_schedulers = cast_param_groups(param_groups)
  
      # Convert constant values to constant param schedulers. Use kwargs
      # values as defaults.
      for pg in self._param_group_schedulers:
          for k, v in kwargs.items():
              if isinstance(v, (int, float)):
                  pg[k] = ConstantParamScheduler(v)
              else:
                  # This is necessary to copy values from kwargs to pg
                  pg[k] = v
  
          for k, v in pg.items():
              if isinstance(v, (int, float)):
                  pg[k] = ConstantParamScheduler(v)
  
      self.prepare(self._run_schedulers(0, None))
  
imports: from abc import ABC, abstractmethod
  from typing import Any, Callable, Dict, Optional
  from classy_vision.generic.util import log_class_usage
  from .param_scheduler import ConstantParamScheduler, ParamScheduler, UpdateInterval
label_desc: Use image node_id 4 for calling the ClassyOptimizer obj's underlying member method code with example usage: obj.set_param_groups(param_groups) and returns: pg, list, list