docstr: Instantiates a SGD from a configuration.
  
  Args:
      config: A configuration for a SGD.
          See :func:`__init__` for parameters expected in the config.
  
  Returns:
      A SGD instance.
docstr_tok: ["Instantiates","a","SGD","from","a","configuration",".","Args",":","config",":","A","configuration","for","a","SGD",".","See",":","func",":","`","__init__","`","for","parameters","expected","in","the","config",".","Returns",":","A","SGD","instance","."]
code: def from_config(cls, config: Dict[str, Any]) -> "SGD":
      """Instantiates a SGD from a configuration.
  
      Args:
          config: A configuration for a SGD.
              See :func:`__init__` for parameters expected in the config.
  
      Returns:
          A SGD instance.
      """
      # Default params
      config.setdefault("lr", 0.1)
      config.setdefault("momentum", 0.0)
      config.setdefault("weight_decay", 0.0)
      config.setdefault("nesterov", False)
      config.setdefault("use_larc", False)
      config.setdefault(
          "larc_config",
          {"clip": True, "eps": 1e-08, "trust_coefficient": 0.02},
      )
  
      assert (
          config["momentum"] >= 0.0
          and config["momentum"] < 1.0
          and type(config["momentum"]) == float
      ), "Config must contain a 'momentum' in [0, 1) for SGD optimizer"
      assert isinstance(
          config["nesterov"], bool
      ), "Config must contain a boolean 'nesterov' param for SGD optimizer"
      assert isinstance(
          config["use_larc"], bool
      ), "Config must contain a boolean 'use_larc' param for SGD optimizer"
  
      return cls(
          larc_config=config["larc_config"],
          lr=config["lr"],
          momentum=config["momentum"],
          weight_decay=config["weight_decay"],
          nesterov=config["nesterov"],
          use_larc=config["use_larc"],
      )
  
file_path: ClassyVision/classy_vision/optim/sgd.py
imports: from typing import Any, Dict
  import torch.optim
  from .None import ClassyOptimizer, register_optimizer
label_desc: Use image node_id 3 for calling the SGD obj's underlying member method code with example usage: obj.from_config(cls, config) and returns: cls