facenet中triplet_loss实现
Created by: WangTaoSpace
pos_dist = tf.reduce_sum(tf.square(tf.subtract(anchor, positive)), 1)
neg_dist = tf.reduce_sum(tf.square(tf.subtract(anchor, negative)), 1)
basic_loss = tf.add(tf.subtract(pos_dist,neg_dist), alpha)
loss = tf.reduce_mean(tf.maximum(basic_loss, 0.0), 0)
我想在paddle中实现上面的loss,但是 paddle 0.11.0 v2.layer 我没有找到向量减法和tf.maximum 这个方法的替代。