class_docstr: UNITER embedding and transformer trunk for V-L modeling.
  Modified from https://github.com/ChenRocks/UNITER/ for MMF.
  https://arxiv.org/pdf/1909.11740.pdf
  
  By default, this model uses the pretrained bert-base-uncased
  transformer trunk with from huggingface.
  
  To train on this model through MMF, look at the UNITER model,
  which supports pretraining and finetuning of UNITERModelBase
  with configurable heads.
  
  For an example of using this model standalone,
  take a look at its unit test in `test_uniter.py`.
class_docstr_tok: ["UNITER","embedding","and","transformer","trunk","for","V-L","modeling",".","Modified","from","https",":","\/\/github.com\/ChenRocks\/UNITER\/","for","MMF",".","https",":","\/\/arxiv.org\/pdf\/1909.11740.pdf","By","default",",","this","model","uses","the","pretrained","bert-base-uncased","transformer","trunk","with","from","huggingface",".","To","train","on","this","model","through","MMF",",","look","at","the","UNITER","model",",","which","supports","pretraining","and","finetuning","of","UNITERModelBase","with","configurable","heads",".","For","an","example","of","using","this","model","standalone",",","take","a","look","at","its","unit","test","in","`","test_uniter.py","`","."]
code: def _compute_img_embeddings(
      self,
      img_feat: Tensor,
      img_pos_feat: Tensor,
      img_masks: Optional[Tensor] = None,
      img_type_ids: Optional[Tensor] = None,
  ) -> Tensor:
      if img_type_ids is None:
          img_type_ids = torch.ones_like(img_feat[:, :, 0].long())
      img_type_embeddings = self.text_embeddings.token_type_embeddings(
          img_type_ids
      )
      output = self.img_embeddings(
          img_feat, img_pos_feat, img_type_embeddings, img_masks
      )
      return output
  
imports: import copy
  import logging
  import random
  from collections import namedtuple
  from collections.abc import MutableMapping
  from dataclasses import asdict, dataclass, field
  from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from mmf.common.registry import registry
  from mmf.models import BaseModel
  from mmf.modules.losses import MMFLoss
  from mmf.utils.general import retry_n
  from omegaconf import DictConfig, MISSING, OmegaConf
  from torch import nn, Tensor
label_desc: Use image node_id 3 for calling the UNITERModelBase obj's underlying member method code with example usage: obj._compute_img_embeddings(img_feat, img_pos_feat, img_masks, img_type_ids) and returns: output