code: def test_input_indices_tuple(self):
      lossA = ContrastiveLoss()
      lossB = TripletMarginLoss(0.1)
      miner = MultiSimilarityMiner()
      loss_func1 = MultipleLosses(
          losses={"lossA": lossA, "lossB": lossB},
          weights={"lossA": 1, "lossB": 0.23},
      )
  
      loss_func2 = MultipleLosses(
          losses=[lossA, lossB], weights=[1, 0.23]
      )
  
      for loss_func in [loss_func1, loss_func2]:
          for dtype in TEST_DTYPES:
              embedding_angles = torch.arange(0, 180)
              embeddings = torch.tensor(
                  [angle_to_coord(a) for a in embedding_angles],
                  requires_grad=True,
                  dtype=dtype,
              ).to(
                  TEST_DEVICE
              )  # 2D embeddings
              labels = torch.randint(low=0, high=10, size=(180,))
              indices_tuple = miner(embeddings, labels)
  
              loss = loss_func(embeddings, labels, indices_tuple)
              loss.backward()
  
              correct_loss = (
                  lossA(embeddings, labels, indices_tuple)
                  + lossB(embeddings, labels, indices_tuple) * 0.23
              )
              self.assertTrue(torch.isclose(loss, correct_loss))
  
file_path: pytorch-metric-learning/tests/losses/test_multiple_losses.py
imports: import unittest
  import torch
  from pytorch_metric_learning.losses import ContrastiveLoss, MultipleLosses, TripletMarginLoss
  from pytorch_metric_learning.miners import MultiSimilarityMiner
  from ..None import TEST_DEVICE, TEST_DTYPES
  from ..zzz_testing_utils.testing_utils import angle_to_coord
label_desc: Use image node_id 2 for calling the TestMultipleLosses obj's underlying member method code with example usage: obj.test_input_indices_tuple() without return types