code: def test_pnp_loss(self):
      torch.manual_seed(30293)
      bs = 180
      classes = 30
      for variant in PNPLoss.VARIANTS:
          original_variant = {
              "Ds": "PNP-D_s",
              "Dq": "PNP-D_q",
              "Iu": "PNP-I_u",
              "Ib": "PNP-I_b",
              "O": "PNP-O",
          }[variant]
          b, alpha, anneal = 2, 4, 0.01
          loss_func = PNPLoss(b, alpha, anneal, variant)
          original_loss_func = OriginalImplementationPNP(
              b, alpha, anneal, original_variant, bs, classes
          ).to(TEST_DEVICE)
  
          for dtype in TEST_DTYPES:
              embeddings = torch.randn(
                  180,
                  32,
                  dtype=dtype,
                  device=TEST_DEVICE,
                  requires_grad=True,
              )
              labels = (
                  torch.tensor(
                      [
                          [i] * (int(bs / classes))
                          for i in range(classes)
                      ]
                  )
                  .reshape(-1)
                  .to(TEST_DEVICE)
              )
              loss = loss_func(embeddings, labels)
              loss.backward()
              correct_loss = original_loss_func(
                  F.normalize(embeddings, dim=-1)
              )
  
              rtol = 1e-2 if dtype == torch.float16 else 1e-5
              self.assertTrue(
                  torch.isclose(loss, correct_loss[0], rtol=rtol)
              )
  
      with self.assertRaises(ValueError):
          PNPLoss(b, alpha, anneal, "PNP")
  
file_path: pytorch-metric-learning/tests/losses/test_pnp_loss.py
imports: import unittest
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.nn.functional
  from pytorch_metric_learning.losses import PNPLoss
  from ..None import TEST_DEVICE, TEST_DTYPES
label_desc: Use image node_id 1 for calling the TestPNPLoss obj's underlying member method code with example usage: obj.test_pnp_loss() without return types