code: def center_loss(
      embedding, label, num_classes, alpha=0.1, scope="center_loss"
  ):
      r"""Center-Loss as described in the paper
      `A Discriminative Feature Learning Approach for Deep Face Recognition`
      <http://ydwen.github.io/papers/WenECCV16.pdf> by Wen et al.
  
      Args:
          embedding (tf.Tensor): features produced by the network
          label (tf.Tensor): ground-truth label for each feature
          num_classes (int): number of different classes
          alpha (float): learning rate for updating the centers
  
      Returns:
          tf.Tensor: center loss
      """
      nrof_features = embedding.get_shape()[1]
      centers = tf.get_variable(
          "centers",
          [num_classes, nrof_features],
          dtype=tf.float32,
          initializer=tf.constant_initializer(0),
          trainable=False,
      )
      label = tf.reshape(label, [-1])
      centers_batch = tf.gather(centers, label)
      diff = (1 - alpha) * (centers_batch - embedding)
      centers = tf.scatter_sub(centers, label, diff)
      loss = tf.reduce_mean(
          tf.square(embedding - centers_batch), name=scope
      )
      return loss
  
imports: import argparse
  import numpy
  import tensorflow
  import tensorflow.contrib.slim
  from tensorpack import *
  from tensorpack.tfutils.summary import add_moving_summary
  from tensorpack.utils.gpu import change_gpu
  from embedding_data import MnistPairs, MnistTriplets, get_test_data
label_desc: Use image node_id 5 for calling a global function with example usage: center_loss(embedding, label, num_classes, alpha, scope) and returns: loss