Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Hackathon No.30】 #34

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update api_design_for_tripletmargindistanceloss.md
yangguohao authored Mar 19, 2022
commit 7563cddd1ca4a9e548fcea6056286e82c6a404f3
13 changes: 8 additions & 5 deletions rfcs/APIs/api_design_for_tripletmargindistanceloss.md
Original file line number Diff line number Diff line change
@@ -161,9 +161,10 @@ def triplet_loss(queries, positives, negatives, margin=0.1):
## API实现方案
distance functions可以采用paddle.nn.PairWiseDistance来进行实现
1. 检查参数

1. 检查 reduction 有效性(同其余 functional loss 中的实现)
2. 检查输入的 dtype(含 `input``positive``negative`)(同其余 functional loss 中的实现)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

输入损失的不一定为(N,dim),需要检查维度之后进行维度转换

3. 检查输入的`input``positive``negative`维度是否相同

shiyutang marked this conversation as resolved.
Show resolved Hide resolved
2. 计算

@@ -175,10 +176,12 @@ distance functions可以采用paddle.nn.PairWiseDistance来进行实现
# 六、测试和验收的考量

测试考虑的case如下:
1.动态图,静态图,要与np计算下的结果输出需要一致。
2.自定义distanc_function动态图静态图下输出一致。
2.在swap下,动态图静态图输出结果一致。

- 1.动态图,静态图,要与np计算下的结果输出需要一致。
- 2.CPU、GPU下计算一致。
- 3.各reduction下计算一致
- 4.各参数输入有效。
- 5.反向梯度的正确性。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前已经调整基于python 进行组合的API不需要进行反向梯度的验证

-
# 七、可行性分析和排期规划
方案主要依赖现有paddle api组合而成,可以满足在当前版本周期内开发完成。