diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index e2c1a65411d7d33ff45a042504bbb8ea95be77e5..8e1e4813247bdf1ed0d725591f789f8640f3fc49 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -10567,17 +10567,17 @@ def npair_loss(anchor, positive, labels, l2_reg=0.002): ''' **Npair Loss Layer** - see http://www.nec-labs.com/uploads/images/Department-Images/MediaAnalytics/papers/nips16_npairmetriclearning.pdf - - Npair loss requires paired data. Npair loss has two parts, the first part is L2 - regularizer on the embedding vector, the second part is cross entropy loss which + Read `Improved Deep Metric Learning with Multi class N pair Loss Objective `_ . + + Npair loss requires paired data. Npair loss has two parts: the first part is L2 + regularizer on the embedding vector; the second part is cross entropy loss which takes the similarity matrix of anchor and positive as logits. Args: anchor(Variable): embedding vector for the anchor image. shape=[batch_size, embedding_dims] positive(Variable): embedding vector for the positive image. shape=[batch_size, embedding_dims] - labels(Varieble): 1-D tensor. shape=[batch_size] - l2_res(float32): L2 regularization term on embedding vector, default: 0.02 + labels(Variable): 1-D tensor. shape=[batch_size] + l2_reg(float32): L2 regularization term on embedding vector, default: 0.002 Returns: npair loss(Variable): return npair loss, shape=[1]