class_docstr: Embedding class that can take any number of image or text modalities, each can
  have their input id, position id and segment id. We generate embeddings of
  dimension config.hidden_size for each and then first add the three embeddings
  for each modality to have a modality specific embedding. We then concat the
  modality specific embeddings to have a joint embedding.
class_docstr_tok: ["Embedding","class","that","can","take","any","number","of","image","or","text","modalities",",","each","can","have","their","input","id",",","position","id","and","segment","id",".","We","generate","embeddings","of","dimension","config.hidden_size","for","each","and","then","first","add","the","three","embeddings","for","each","modality","to","have","a","modality","specific","embedding",".","We","then","concat","the","modality","specific","embeddings","to","have","a","joint","embedding","."]
code: def forward(
      self,
      tokens_ids: Dict[str, Tensor],
      position_ids: Dict[str, Tensor],
      segment_ids: Dict[str, Tensor],
  ) -> Tensor:
      list_embeddings = []
      for idx, (token_emb, pos_emb, layer_norm, dropout) in enumerate(
          zip(
              self.token_embeddings,
              self.pos_embeddings,
              self.layer_norms,
              self.dropouts,
          )
      ):
          modality_name = self.modality_keys[idx]
          total_embedding = token_emb(tokens_ids[modality_name])
  
          if modality_name in position_ids:
              total_embedding += pos_emb(position_ids[modality_name])
  
          if modality_name in segment_ids:
              total_embedding += self.token_type_embeddings(
                  segment_ids[modality_name]
              )
  
          list_embeddings.append(dropout(layer_norm(total_embedding)))
  
      return torch.cat(list_embeddings, dim=1)
  
imports: from copy import deepcopy
  from typing import Any, Dict, List, Type
  import torch
  from mmf.common.registry import registry
  from mmf.models.transformers.base import BaseTransformer, BaseTransformerBackend
  from mmf.modules.hf_layers import BertModelJit, replace_with_jit
  from omegaconf import OmegaConf
  from torch import nn, Tensor
label_desc: Use image node_id 4 for calling the HuggingfaceEmbeddings obj's underlying member method code with example usage: obj.forward(tokens_ids, position_ids, segment_ids) and returns: torch