From 0a236634317cd7696f8c999f343906509273f10f Mon Sep 17 00:00:00 2001 From: Netpunk <2327994230@qq.com> Date: Mon, 30 May 2022 16:41:46 +0800 Subject: [PATCH 1/2] change parameter name --- rfcs/APIs/20220319_api_design_for_CosineEmbeddingLoss.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rfcs/APIs/20220319_api_design_for_CosineEmbeddingLoss.md b/rfcs/APIs/20220319_api_design_for_CosineEmbeddingLoss.md index 281e28721..c253949eb 100644 --- a/rfcs/APIs/20220319_api_design_for_CosineEmbeddingLoss.md +++ b/rfcs/APIs/20220319_api_design_for_CosineEmbeddingLoss.md @@ -124,12 +124,12 @@ def cosine_similarity(y_true, y_pred, axis=-1): ## 命名与参数设计 -CosineEmbeddingLoss的API设计为`paddle.nn.CosineEmbeddingLoss(margin=0, reduction='mean')`,cosine_embedding_loss的API设计为`paddle.nn.functional.cosine_embedding_loss(x1, x2, target, margin=0, reduction='mean')`,其中: +CosineEmbeddingLoss的API设计为`paddle.nn.CosineEmbeddingLoss(margin=0, reduction='mean', name=None)`,cosine_embedding_loss的API设计为`paddle.nn.functional.cosine_embedding_loss(input1, input2, label, margin=0, reduction='mean', name=None)`,其中: * margin:余弦相似度损失函数中的margin值 * reduction:结果后处理的类型,可以为`mean`或者`sum` -* x1和x2:输入的两个tensor -* target:真实的类别标签 +* input1和input2:输入的两个tensor +* label:真实的类别标签 在pytorch中,CosineEmbeddingLoss还有`size_average`、`reduce`两个参数,但是已经弃用,其功能转移到`reduction`参数上。两个参数的描述文档如下 From 2ddc24b6e58d7a8f21c68feb3ffc9052c2712404 Mon Sep 17 00:00:00 2001 From: Netpunk <2327994230@qq.com> Date: Tue, 31 May 2022 14:17:28 +0800 Subject: [PATCH 2/2] add name parameter --- rfcs/APIs/20220319_api_design_for_CosineEmbeddingLoss.md | 1 + 1 file changed, 1 insertion(+) diff --git a/rfcs/APIs/20220319_api_design_for_CosineEmbeddingLoss.md b/rfcs/APIs/20220319_api_design_for_CosineEmbeddingLoss.md index c253949eb..e6b89bc83 100644 --- a/rfcs/APIs/20220319_api_design_for_CosineEmbeddingLoss.md +++ b/rfcs/APIs/20220319_api_design_for_CosineEmbeddingLoss.md @@ -130,6 +130,7 @@ CosineEmbeddingLoss的API设计为`paddle.nn.CosineEmbeddingLoss(margin=0, reduc * reduction:结果后处理的类型,可以为`mean`或者`sum` * input1和input2:输入的两个tensor * label:真实的类别标签 +* name:操作的名称,更多信息请参见 [Name](https://www.paddlepaddle.org.cn/documentation/docs/zh/api_guides/low_level/program.html#api-guide-name)。 在pytorch中,CosineEmbeddingLoss还有`size_average`、`reduce`两个参数,但是已经弃用,其功能转移到`reduction`参数上。两个参数的描述文档如下