code: def test_queue(self):
      for test_enqueue_mask in [False, True]:
          for dtype in TEST_DTYPES:
              batch_size = 32
              enqueue_batch_size = 15
              self.loss = CrossBatchMemory(
                  loss=ContrastiveLoss(),
                  embedding_size=self.embedding_size,
                  memory_size=self.memory_size,
              )
              for i in range(30):
                  embeddings = (
                      torch.randn(batch_size, self.embedding_size)
                      .to(TEST_DEVICE)
                      .type(dtype)
                  )
                  labels = torch.arange(batch_size).to(TEST_DEVICE)
                  q = self.loss.queue_idx
                  B = (
                      enqueue_batch_size
                      if test_enqueue_mask
                      else batch_size
                  )
                  if test_enqueue_mask:
                      enqueue_mask = torch.zeros(batch_size).bool()
                      enqueue_mask[:-2:2] = True
                  else:
                      enqueue_mask = None
  
                  self.assertTrue(q == (i * B) % self.memory_size)
                  self.loss(
                      embeddings, labels, enqueue_mask=enqueue_mask
                  )
  
                  start_idx = q
                  if q + B == self.memory_size:
                      end_idx = self.memory_size
                  else:
                      end_idx = (q + B) % self.memory_size
                  if start_idx < end_idx:
                      if test_enqueue_mask:
                          self.assertTrue(
                              torch.equal(
                                  embeddings[enqueue_mask],
                                  self.loss.embedding_memory[
                                      start_idx:end_idx
                                  ],
                              )
                          )
                          self.assertTrue(
                              torch.equal(
                                  labels[enqueue_mask],
                                  self.loss.label_memory[
                                      start_idx:end_idx
                                  ],
                              )
                          )
                      else:
                          self.assertTrue(
                              torch.equal(
                                  embeddings,
                                  self.loss.embedding_memory[
                                      start_idx:end_idx
                                  ],
                              )
                          )
                          self.assertTrue(
                              torch.equal(
                                  labels,
                                  self.loss.label_memory[
                                      start_idx:end_idx
                                  ],
                              )
                          )
                  else:
                      correct_embeddings = torch.cat(
                          [
                              self.loss.embedding_memory[start_idx:],
                              self.loss.embedding_memory[:end_idx],
                          ],
                          dim=0,
                      )
                      correct_labels = torch.cat(
                          [
                              self.loss.label_memory[start_idx:],
                              self.loss.label_memory[:end_idx],
                          ],
                          dim=0,
                      )
                      if test_enqueue_mask:
                          self.assertTrue(
                              torch.equal(
                                  embeddings[enqueue_mask],
                                  correct_embeddings,
                              )
                          )
                          self.assertTrue(
                              torch.equal(
                                  labels[enqueue_mask], correct_labels
                              )
                          )
                      else:
                          self.assertTrue(
                              torch.equal(
                                  embeddings, correct_embeddings
                              )
                          )
                          self.assertTrue(
                              torch.equal(labels, correct_labels)
                          )
  
imports: import unittest
  import torch
  import pytorch_metric_learning.losses
  from pytorch_metric_learning.losses import ContrastiveLoss, CrossBatchMemory, MultiSimilarityLoss, NTXentLoss
  from pytorch_metric_learning.miners import DistanceWeightedMiner, MultiSimilarityMiner, PairMarginMiner, TripletMarginMiner
  from pytorch_metric_learning.utils import loss_and_miner_utils
  from ..None import TEST_DEVICE, TEST_DTYPES
  from ..zzz_testing_utils.testing_utils import angle_to_coord
label_desc: Use image node_id 7 for calling the TestCrossBatchMemory obj's underlying member method code with example usage: obj.test_queue() without return types