class_docstr: Compute contrastive loss between image and text pairs.
  
  Args:
      opts: command-line arguments
class_docstr_tok: ["Compute","contrastive","loss","between","image","and","text","pairs",".","Args",":","opts",":","command-line","arguments"]
code: def __init__(self, opts: argparse.Namespace, *args, **kwargs) -> None:
      super().__init__(opts, *args, **kwargs)
      # need to set these default to prevent tests for failing
      self.rank = getattr(opts, "ddp.rank", 0)
      self.use_distributed = getattr(opts, "ddp.use_distributed", False)
      self.device = getattr(opts, "dev.device", torch.device("cpu"))
  
file_path: ml-cvnets/loss_fn/multi_modal_img_text/contrastive_loss_clip.py
imports: import argparse
  from typing import Any, Dict, Tuple
  import torch
  from torch import Tensor
  from torch.nn import functional
  from loss_fn import LOSS_REGISTRY
  from loss_fn.multi_modal_img_text.base_multi_modal_img_text_criteria import BaseMultiModalImageTextCriteria
  from utils import logger
  from utils.tensor_utils import gather_all_features
label_desc: Use image node_id 1 to create a new ContrastiveLossClip object from inherited base classes: BaseMultiModalImageTextCriteria with example: obj = ContrastiveLossClip(opts)