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.26】 #27

Closed
wants to merge 1 commit into from

Conversation

gsq7474741
Copy link
Contributor

为 Paddle 新增 TripletMarginLoss 损失函数API rfc

@gsq7474741
Copy link
Contributor Author

@TCChenlong

@dingjiaweiww
Copy link
Contributor

你的 PR 提交成功,感谢你对于开源项目的贡献,请检查 PR 提交格式和内容是否完备,具体请参考示例模版

@dingjiaweiww
Copy link
Contributor

PR 格式检查通过,你的PR 将接受Paddle 专家以及开源社区的review,请及时关注PR 动态

@dingjiaweiww
Copy link
Contributor

reviewing

Copy link
Contributor

@shiyutang shiyutang left a comment

Choose a reason for hiding this comment

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

paddle.nn.TripletMarginLoss 是三元损失函数,其针对 anchor 和正负对计算 P 范数距离下的三元损失,从而获得损失值。

## 3、意义
使paddle支持更多的损失函数
Copy link
Contributor

Choose a reason for hiding this comment

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

意义可以进一步具体化,比如增加APIxx,实现xx的功能。

无此功能,但可以在python层通过调用基础api的形式实现。

# 三、业内方案调研
torch有此api,是在c++层实现的,不过调用的基础op飞桨均有实现
Copy link
Contributor

Choose a reason for hiding this comment

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

可以补充完整 torch api 的实现方式,包含关键代码和核心逻辑,从而明确实现原理

使paddle支持更多的损失函数

# 二、飞桨现状
无此功能,但可以在python层通过调用基础api的形式实现。
Copy link
Contributor

Choose a reason for hiding this comment

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

可以进一步参考 paddle 其他损失函数 API 实现方式,并对关键逻辑、是否可以复用进行描述

Comment on lines +27 to +28
本方案计划在python层开发,不涉及底层c++,故减轻了日后的编译开销,计算全部在c++层,不会损失性能。
且与torch的api一致,方便用户无缝迁移到paddle。
Copy link
Contributor

Choose a reason for hiding this comment

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

对比分析部分可以阐述不同方案(torch,paddle,numpy,tensorflow等)对于参数设计差异,对参数维度支持差异,特殊场景支持差异等。

Comment on lines +42 to +43
核心功能放在functional中,在nn中暴露出来,方便用户调用,与其它api一致

Copy link
Contributor

@shiyutang shiyutang Mar 15, 2022

Choose a reason for hiding this comment

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

实现方案中需要指明关键逻辑步骤

Comment on lines +45 to +47
- 数值正确性及稳定性
- 支持的数据类型
- 异常检测
Copy link
Contributor

Choose a reason for hiding this comment

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

测试用例需要进一步具体化

Copy link
Contributor

@shiyutang shiyutang left a comment

Choose a reason for hiding this comment

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

请按照评审意见进行修改

@paddle-bot-old
Copy link

你的PR有最新反馈,请及时修改。
There’s the latest feedback about your PR. Please check.

@TCChenlong
Copy link
Contributor

#31 merged, this PR is closed, thanks for your contribution!

@TCChenlong TCChenlong closed this Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants