-
Notifications
You must be signed in to change notification settings - Fork 294
【Hackathon 6th No.7】Add sinc / sinc_ API to Paddle #836
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
Conversation
|
||
## 底层OP设计 | ||
|
||
c++接口为 `_C_ops.sinc` 和 `_C_ops.sinc_` |
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.
该OP能否通过组合算子的方式实现?
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.
可以的,但是如果按numpy的做法用where来对等于0的元素做替换的话,应该需要临时创建一个和输入一样大小的tensor,这样对于sinc_这个inplace operator而言这一部分又需要占用额外的空间,我想用底层kernel的话可能会省一些空间?
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.
没关系,走组合算子的实现方式就行。
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.
好的
- 正确性验证:可以与 NumPy 的结果对齐; | ||
- 不同 shape; | ||
- 前向计算; | ||
- 计算dtype类型:验证 `float64`,`float32`等; |
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.
是否还能支持更多数据类型?
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.
数据类型支持 float16,float32,float64。(paddle.sin 支持 float16,float32,float64)
|
||
不涉及底层OP | ||
|
||
## API实现方案 |
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.
给出实现方案
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.
已修改
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.
LGTM
|
||
# 一、概述 | ||
## 1、相关背景 | ||
[NO.7 为 Paddle 新增 PolynomialLR / sinc / sinc_ API](https://github.com/PaddlePaddle/community/blob/master/hackathon/hackathon_6th/【Hackathon%206th】开源贡献个人挑战赛框架开发任务合集.md#no7-为-paddle-新增-polynomiallr--sinc--sinc_-api) |
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.
这处需要修改,没有 PolynomialLR 了
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.
已修改
x = np.asanyarray(x) | ||
y = pi * where(x == 0, 1.0e-20, x) | ||
return sin(y)/y | ||
``` |
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.
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.
已修改
Add rfcs for sinc / sinc_ API.