class_docstr: Three way contrastive loss used for VinVL pretraining.
  Described here https://arxiv.org/pdf/2101.00529
  
  A thin wrapper around MLP for 3 way classification.
  Effectively ITM with 3 labels.
  contrastive 3-way loss has 3 labels,
  0 for a match, 1, 2 for a corrupt caption/image
code: def __init__(self, config: Config, *args, **kwargs):
      super().__init__(config, *args, **kwargs)
      # Head modules
      self.contrast_head = MLP(config=self.config)
      # Loss
      self.ce_loss = torch.nn.CrossEntropyLoss(
          ignore_index=self.config.ignore_index
      )
  
file_path: mmf/mmf/models/transformers/heads/contrastive.py
imports: from dataclasses import dataclass
  from typing import Dict, Optional
  import torch
  from mmf.common.registry import registry
  from mmf.models.transformers.base import BaseTransformerHead
  from mmf.models.transformers.heads.mlp import MLP
label_desc: Use image node_id 1 to create a new ThreeWayContrastive object from inherited base classes: BaseTransformerHead with example: obj = ThreeWayContrastive(config)