code: def test_hard_tripled_loss_angular(
      dtype, soft, dist_func, dist_metric
  ):
      num_data = 20
      feat_dim = 6
      margin = 1.0
      num_classes = 4
  
      embedding = np.random.rand(num_data, feat_dim).astype(np.float32)
      labels = np.random.randint(0, num_classes, size=(num_data))
  
      # Compute the loss in NP.
      loss_np = triplet_hard_loss_np(
          labels, embedding, margin, dist_func, soft
      )
  
      # Compute the loss in TF.
      y_true = tf.constant(labels)
      y_pred = tf.constant(embedding, dtype=dtype)
      cce_obj = triplet.TripletHardLoss(
          soft=soft, distance_metric=dist_metric
      )
      loss = cce_obj(y_true, y_pred)
      test_utils.assert_allclose_according_to_type(
          loss.numpy(), loss_np
      )
  
file_path: addons/tensorflow_addons/losses/tests/triplet_test.py
imports: import pytest
  import numpy
  import tensorflow
  from tensorflow_addons.losses import triplet
  from tensorflow_addons.utils import test_utils
label_desc: Use image node_id 10 for calling a global function with example usage: test_hard_tripled_loss_angular(dtype, soft, dist_func, dist_metric) without return types