class_docstr: Implementation of  Dual-Path Convolutional Image-Text Embeddings with Instance Loss, ACM TOMM 2020
  https://arxiv.org/abs/1711.05535
  using cross-entropy loss for every sample if label is not available, else use given label.
code: def compute_loss(
      self, embeddings, labels, indices_tuple, ref_emb, ref_labels
  ):
      c_f.labels_required(labels)
      c_f.indices_tuple_not_supported(indices_tuple)
      c_f.ref_not_supported(embeddings, labels, ref_emb, ref_labels)
      sim1 = self.distance(embeddings) * self.gamma
      if labels is None:
          sim_label = c_f.torch_arange_from_size(embeddings)
      else:
          _, sim_label = torch.unique(labels, return_inverse=True)
      loss = F.cross_entropy(sim1, sim_label, reduction="none")
      return {
          "loss": {
              "losses": loss,
              "indices": c_f.torch_arange_from_size(embeddings),
              "reduction_type": "element",
          }
      }
  
file_path: pytorch-metric-learning/src/pytorch_metric_learning/losses/instance_loss.py
imports: import torch
  import torch.nn.functional
  from ..distances import CosineSimilarity
  from ..reducers import MeanReducer
  from ..utils import common_functions
  from .base_metric_loss_function import BaseMetricLossFunction
label_desc: Use image node_id 2 for calling the InstanceLoss obj's underlying member method code with example usage: obj.compute_loss(embeddings, labels, indices_tuple, ref_emb, ref_labels) and returns: dict