code: def test_check_shapes(self):
      embeddings = torch.randn(32, 512, 3)
      labels = torch.randint(0, 10, size=(32,))
      loss_fn = TripletMarginLoss()
  
      # embeddings is 3-dimensional
      self.assertRaises(ValueError, lambda: loss_fn(embeddings, labels))
  
      # embeddings does not match labels
      embeddings = torch.randn(33, 512)
      self.assertRaises(ValueError, lambda: loss_fn(embeddings, labels))
  
      # labels is 2D
      embeddings = torch.randn(32, 512)
      labels = labels.unsqueeze(1)
      self.assertRaises(ValueError, lambda: loss_fn(embeddings, labels))
  
      # correct shapes
      labels = labels.squeeze(1)
      self.assertTrue(torch.is_tensor(loss_fn(embeddings, labels)))
  
file_path: pytorch-metric-learning/tests/utils/test_common_functions.py
imports: import logging
  import unittest
  import numpy
  import torch
  from sklearn.preprocessing import StandardScaler
  from pytorch_metric_learning.losses import TripletMarginLoss
  from pytorch_metric_learning.utils import common_functions
  from ..None import WITH_COLLECT_STATS
label_desc: Use image node_id 3 for calling the TestCommonFunctions obj's underlying member method code with example usage: obj.test_check_shapes() without return types