code: def test_custom_embedding_ndim(self):
      embeddings = torch.randn(32, 3, 128)
      labels = torch.randint(0, 10, size=(32,))
      loss_fn = TripletMarginLoss(distance=LpDistance())
  
      with self.assertRaises(ValueError):
          loss_fn(embeddings, labels)
  
      loss_fn = TripletMarginLoss(distance=CustomDistance())
      loss_fn(embeddings, labels)
  
file_path: pytorch-metric-learning/tests/distances/test_custom_check_shape.py
imports: import unittest
  import torch
  from pytorch_metric_learning.distances import BaseDistance, LpDistance
  from pytorch_metric_learning.losses import TripletMarginLoss
label_desc: Use image node_id 1 for calling the TestCustomCheckShape obj's underlying member method code with example usage: obj.test_custom_embedding_ndim() without return types