class_docstr: HeadsDict class manages the construction and forward pass for
  multiple possible heads for multi-task learning.
  Construction from list or dict configs is supported,
  take a look at `build_heads_dict(head_configs, tasks, losses)`.
code: def __init__(
      self,
      heads: Union[nn.ModuleDict, nn.ModuleList],
      head_names: Union[Dict, List],
      losses: Dict,
      head_loss_names: Union[Dict, List],
  ):
      super().__init__()
      self.heads = heads
      self.head_names = head_names
      self.losses = losses
      self.head_loss_names = head_loss_names
  
file_path: mmf/mmf/models/transformers/heads/utils.py
imports: import collections
  import collections.abc
  from typing import Dict, List, Optional, Union
  from mmf.common.registry import registry
  from torch import nn, Tensor
label_desc: Use image node_id 1 to create a new HeadsDict object from inherited base classes: nn with example: obj = HeadsDict(heads, head_names, losses, head_loss_names)