code: def test_sdml_loss():
      N = 5  # number of samples
      DIM = 10  # Dimensionality
      EPOCHS = 20
  
      # Generate randomized data and 'positive' samples
      data = mx.np.random.uniform(-1, 1, size=(N, DIM))
      pos = data + mx.np.random.uniform(
          -0.1, 0.1, size=(N, DIM)
      )  # correlated paired data
      data_iter = mx.io.NDArrayIter(
          {"data": data, "pos": pos}, batch_size=N
      )
  
      # Init model and trainer
      sdml_loss = gluon.loss.SDMLLoss()
      model = gluon.nn.Dense(
          DIM, activation="tanh"
      )  # Simple NN encoder
      model.initialize(mx.init.Xavier(), device=mx.current_device())
      trainer = gluon.Trainer(
          model.collect_params(), "adam", {"learning_rate": 0.1}
      )
  
      for _ in range(EPOCHS):  # Training loop
          data_iter.reset()
          for iter_batch in data_iter:
              batch = [
                  datum.to_device(mx.current_device()).as_np_ndarray()
                  for datum in iter_batch.data
              ]
              with autograd.record():
                  data, pos = batch
                  z_data, z_pos = model(data), model(pos)
                  loss = sdml_loss(z_data, z_pos)
                  loss.backward()
              trainer.step(1)
  
      # After training euclidean distance between aligned pairs should be lower than all non-aligned pairs
      avg_loss = loss.sum() / len(loss)
      assert avg_loss < 0.05
  
file_path: mxnet/tests/python/unittest/test_numpy_loss.py
imports: import mxnet
  import numpy
  from mxnet import gluon, autograd
  from mxnet.test_utils import assert_almost_equal, default_device, use_np
  from common import xfail_when_nonstandard_decimal_separator
  import pytest
label_desc: Use image node_id 5 for calling a global function with example usage: test_sdml_loss() without return types