未验证 提交 b0d3dd9c 编写于 作者: B Bin Lu 提交者: GitHub

Update npairsloss.py

上级 36a69acb
......@@ -35,19 +35,3 @@ class NpairsLoss(paddle.nn.Layer):
l2loss = 0.5 * reg_lambda * reg
return {"npairsloss": xentloss + l2loss}
if __name__ == "__main__":
import numpy as np
metric = NpairsLoss()
#prepare data
np.random.seed(1)
features = np.random.randn(160, 32)
#print(features)
#do inference
features = paddle.to_tensor(features)
loss = metric(features)
print(loss)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册