class_docstr: Patch embedding used for ViLT.
  https://arxiv.org/pdf/2102.03334.pdf
  Implementation based off
  https://github.com/dandelin/ViLT/blob/master/vilt/modules/vilt_module.py
  Using huggingface ViT modules.
  Can be built with random init or the embeddings weights from an exisiting
  ViT model from huggingface. Model list: availible at
  https://huggingface.co/models?other=vit&sort=downloads
class_docstr_tok: ["Patch","embedding","used","for","ViLT",".","https",":","\/\/arxiv.org\/pdf\/2102.03334.pdf","Implementation","based","off","https",":","\/\/github.com\/dandelin\/ViLT\/blob\/master\/vilt\/modules\/vilt_module.py","Using","huggingface","ViT","modules",".","Can","be","built","with","random","init","or","the","embeddings","weights","from","an","exisiting","ViT","model","from","huggingface",".","Model","list",":","availible","at","https",":","\/\/huggingface.co\/models","?","other=vit","&","sort=downloads"]
code: def forward(self, image: Tensor) -> Tensor:
      if image.dim() == 5:
          image = image.permute(1, 0, 2, 3, 4).flatten(
              start_dim=0, end_dim=1
          )
  
      img_embeddings = self.embedding(image)
  
      img_segment_ids = torch.ones(
          img_embeddings.size()[:-1],
          dtype=img_embeddings.dtype,
          device=img_embeddings.device,
      ).long()
      img_type_embed = self.token_type_embeddings(img_segment_ids)
      img_embeddings = img_embeddings + img_type_embed
      return img_embeddings
  
imports: import collections.abc
  import logging
  from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Tuple
  import torch
  from mmf.common.registry import registry
  from mmf.models.base_model import BaseModel
  from mmf.models.transformers.heads.utils import build_heads_dict
  from mmf.modules.encoders import TransformerEncoder, ViTEncoder
  from mmf.modules.losses import MMFLoss
  from mmf.utils.build import build_encoder
  from mmf.utils.modeling import get_bert_configured_parameters
  from omegaconf import MISSING, OmegaConf
  from torch import nn, Tensor
label_desc: Use image node_id 2 for calling the ViLTImageEmbedding obj's underlying member method code with example usage: obj.forward(image) and returns: img_embeddings