-
Notifications
You must be signed in to change notification settings - Fork 252
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 5th No.11】为 Paddle 新增 igamma 和 igammac API RFC #625
Conversation
测试需要考虑的 case 如下: | ||
|
||
- 输出数值结果的一致性和数据类型是否正确,使用 scipy 作为参考标准 | ||
- 对不同 dtype 的输入数据 `x` 进行计算精度检验 (float32, float64) |
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.
已添加相关内容, PyTorch中 CPU支持(float16, bfloat16, float32, float64),GPU支持(float32, float64)
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.
那么在实现的时候时候是否可以也在CPU中支持float16, bfloat16?
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, bfloat16的支持只需要在注册算子的时候添加相应的类型即可,并没有需要单独实现的部分
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.
已在API实现方案和底层OP设计中添加相应类型支持说明
|
||
## API实现方案 | ||
|
||
该 API 实现于 `python/paddle/tensor/manipulation.py`。 |
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.
python代码放在python/paddle/tensor/math.py,也给出c++代码实现位置
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.
不需要写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.
kernel 部分可以参考 底层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.
这个函数应该是需要新增kernel,需要写出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.
已在底层OP设计添加相应的路径位置
$$ \gamma(a, x) = \int_0^x t^{a-1} e^{-t} dt $$ | ||
|
||
上不完全伽马函数 $\Gamma(a,x)$ 的定义域为 $a>0$,$x\geq 0$,值域为 $(0,\Gamma(a)]$。 | ||
下不完全伽马函数 $\gamma(a,x)$ 的定义域为 $a>0$,$x\geq 0$,值域为 $[0,\Gamma(a))$,其中 $\Gamma(a)$ 是伽马函数的值。 |
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.
上不完全伽马函数和下不完全伽马函数都是单调函数,因此值域只需要算边界值,当x=0时,上不完全伽马函数=Gamma(a),下不完全伽马函数=0,当x趋于正无穷时,上不完全伽马函数趋近于0正,下不完全伽马函数趋近于Gamma(a)负,所以相应的值域就是(0,\Gamma(a)]和[0,\Gamma(a))
LGTM |
|
||
### 实现基础计算逻辑 | ||
根据 igamma (上不完全伽马函数) 的定义,即 | ||
$$ \Gamma(a, x) = \int_x^{\infty} t^{a-1} e^{-t} dt $$ |
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.
我看预览里面还是乱码呢
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.
好像又拉下了这个地方,现在已修复
No description provided.