code: def triplet_loss(anchor, positive, negative, margin=1.0):
      """Triplet Loss.
  
      Computes the triplet loss between y_pred (logits) amd
      y_true (labels).
  
      http://www.bmva.org/bmvc/2016/papers/paper119/paper119.pdf
      V. Balntas, E. Riba et al.
      Learning shallow convolutional feature descriptors with triplet losses
  
  
      Arguments:
          anchor: `Tensor`.
          positive: `Tensor`. Same class as anchor
          negative: `Tensor`. Different class from anchor
          margin: . A self-set parameters that indicate the distance between the expected different identity features
      """
      with tf.name_scope("TripletLoss"):
          dist1_postive = tf.math.reduce_sum(
              tf.math.pow((anchor - positive), 2)
          )
          dist2_negative = tf.math.reduce_sum(
              tf.math.pow((anchor - negative), 2)
          )
          loss = tf.nn.relu(dist1_postive - dist2_negative + margin)
          return loss
  
file_path: tflearn/tflearn/objectives.py
imports: from __future__ import division, print_function, absolute_import
  import tensorflow.compat.v1
  from .config import _EPSILON, _FLOATX
  from .utils import get_from_module
label_desc: Use image node_id 11 for calling a global function with example usage: triplet_loss(anchor, positive, negative, margin) and returns: loss