docstr: Instantiates a DenseNet from a configuration.
  
  Args:
      config: A configuration for a DenseNet.
          See :func:`__init__` for parameters expected in the config.
  
  Returns:
      A DenseNet instance.
docstr_tok: ["Instantiates","a","DenseNet","from","a","configuration",".","Args",":","config",":","A","configuration","for","a","DenseNet",".","See",":","func",":","`","__init__","`","for","parameters","expected","in","the","config",".","Returns",":","A","DenseNet","instance","."]
code: def from_config(cls, config: Dict[str, Any]) -> "DenseNet":
      """Instantiates a DenseNet from a configuration.
  
      Args:
          config: A configuration for a DenseNet.
              See :func:`__init__` for parameters expected in the config.
  
      Returns:
          A DenseNet instance.
      """
      assert "num_blocks" in config
      config = {
          "num_blocks": config["num_blocks"],
          "num_classes": config.get("num_classes"),
          "init_planes": config.get("init_planes", 64),
          "growth_rate": config.get("growth_rate", 32),
          "expansion": config.get("expansion", 4),
          "small_input": config.get("small_input", False),
          "final_bn_relu": config.get("final_bn_relu", True),
          "use_se": config.get("use_se", False),
          "se_reduction_ratio": config.get("se_reduction_ratio", 16),
      }
      return cls(**config)
  
imports: import math
  from collections import OrderedDict
  from typing import Any, Dict, Sequence
  import torch
  import torch.nn
  from classy_vision.generic.util import is_pos_int
  from .None import register_model
  from .classy_model import ClassyModel
  from .squeeze_and_excitation_layer import SqueezeAndExcitationLayer
label_desc: Use image node_id 4 for calling the DenseNet obj's underlying member method code with example usage: obj.from_config(cls, config) and returns: cls