-
Notifications
You must be signed in to change notification settings - Fork 276
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
shiyutang
merged 5 commits into
PaddlePaddle:master
from
yangguohao:triplet_margin_distance_loss
Mar 23, 2022
+192
−0
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
39948dd
Create api_design_for_tripletmargindistanceloss.md
yangguohao f66761b
Update api_design_for_tripletmargindistanceloss.md
yangguohao 69038dc
Update api_design_for_tripletmargindistanceloss.md
yangguohao 7563cdd
Update api_design_for_tripletmargindistanceloss.md
yangguohao ae1e7fb
Update api_design_for_tripletmargindistanceloss.md
yangguohao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update api_design_for_tripletmargindistanceloss.md
commit 7563cddd1ca4a9e548fcea6056286e82c6a404f3
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 中的实现) | ||
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.反向梯度的正确性。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 目前已经调整基于python 进行组合的API不需要进行反向梯度的验证 |
||
- | ||
# 七、可行性分析和排期规划 | ||
方案主要依赖现有paddle api组合而成,可以满足在当前版本周期内开发完成。 | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
输入损失的不一定为(N,dim),需要检查维度之后进行维度转换