code: def forward(self, ans_emb, ocr_emb, prev_inds):
      assert prev_inds.dim() == 2 and prev_inds.dtype == torch.long
      assert ans_emb.dim() == 2
  
      batch_size = prev_inds.size(0)
      seq_length = prev_inds.size(1)
      ans_num = ans_emb.size(0)
  
      # apply layer normalization to both answer embedding and OCR embedding
      # before concatenation, so that they have the same scale
      ans_emb = self.ans_layer_norm(ans_emb)
      ocr_emb = self.ocr_layer_norm(ocr_emb)
      assert ans_emb.size(-1) == ocr_emb.size(-1)
      ans_emb = ans_emb.unsqueeze(0).expand(batch_size, -1, -1)
      ans_ocr_emb_cat = torch.cat([ans_emb, ocr_emb], dim=1)
      raw_dec_emb = _batch_gather(ans_ocr_emb_cat, prev_inds)
  
      # Add position and type embedding for previous predictions
      position_ids = torch.arange(
          seq_length, dtype=torch.long, device=ocr_emb.device
      )
      position_ids = position_ids.unsqueeze(0).expand(
          batch_size, seq_length
      )
      position_embeddings = self.position_embeddings(position_ids)
      # Token type ids: 0 -- vocab; 1 -- OCR
      token_type_ids = prev_inds.ge(ans_num).long()
      token_type_embeddings = self.token_type_embeddings(token_type_ids)
      embeddings = position_embeddings + token_type_embeddings
      embeddings = self.emb_layer_norm(embeddings)
      embeddings = self.emb_dropout(embeddings)
      dec_emb = raw_dec_emb + embeddings
  
      return dec_emb
  
imports: import functools
  import logging
  import math
  import torch
  import torch.nn.functional
  from mmf.common.registry import registry
  from mmf.models.base_model import BaseModel
  from mmf.modules.layers import ClassifierLayer
  from mmf.utils.build import build_image_encoder
  from omegaconf import OmegaConf
  from torch import nn
label_desc: Use image node_id 2 for calling the PrevPredEmbeddings obj's underlying member method code with example usage: obj.forward(ans_emb, ocr_emb, prev_inds) and returns: dec_emb