class_docstr: This head defines a 2d average pooling layer
  (:class:`torch.nn.AdaptiveAvgPool2d`) followed by a fully connected
  layer (:class:`torch.nn.Linear`).
docstr: Instantiates a FullyConnectedHead from a configuration.
  
  Args:
      config: A configuration for a FullyConnectedHead.
          See :func:`__init__` for parameters expected in the config.
  
  Returns:
      A FullyConnectedHead instance.
docstr_tok: ["Instantiates","a","FullyConnectedHead","from","a","configuration",".","Args",":","config",":","A","configuration","for","a","FullyConnectedHead",".","See",":","func",":","`","__init__","`","for","parameters","expected","in","the","config",".","Returns",":","A","FullyConnectedHead","instance","."]
code: def from_config(cls, config: Dict[str, Any]) -> "FullyConnectedHead":
      """Instantiates a FullyConnectedHead from a configuration.
  
      Args:
          config: A configuration for a FullyConnectedHead.
              See :func:`__init__` for parameters expected in the config.
  
      Returns:
          A FullyConnectedHead instance.
      """
      num_classes = config.get("num_classes", None)
      in_plane = config["in_plane"]
      silu = None if get_torch_version() < [1, 7] else nn.SiLU()
      activation = {"relu": nn.ReLU(RELU_IN_PLACE), "silu": silu}[
          config.get("activation", "relu")
      ]
      if activation is None:
          raise RuntimeError(
              "SiLU activation is only supported since PyTorch 1.7"
          )
      return cls(
          config["unique_id"],
          num_classes,
          in_plane,
          conv_planes=config.get("conv_planes", None),
          activation=activation,
          zero_init_bias=config.get("zero_init_bias", False),
          normalize_inputs=config.get("normalize_inputs", None),
      )
  
file_path: ClassyVision/classy_vision/heads/fully_connected_head.py
imports: from typing import Any, Dict, Optional
  import torch.nn
  from classy_vision.generic.util import get_torch_version, is_pos_int
  from classy_vision.heads import ClassyHead, register_head
label_desc: Use image node_id 2 for calling the FullyConnectedHead obj's underlying member method code with example usage: obj.from_config(cls, config) and returns: cls