-
Notifications
You must be signed in to change notification settings - Fork 242
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 4th No.83】为神经网络编译器 CINN 增加 resize 算子 #384
Conversation
MayYouBeProsperous
commented
Feb 26, 2023
•
edited
edited
- 【PaddlePaddle Hackathon 4】核心框架开源贡献 CINN 开发任务合集 Paddle#50661 (comment)
| :-------: | :---------: | :-------: | :------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------: | | ||
| Input | Tensor\<T\> | x | [N, C, in_H, in_W] | 输入张量 | | ||
| Attribute | vector<int> | out_shape | [out_H, out_W] | 调整后的张量大小,只需指定H、W两个维度上的值 | | ||
| Attribute | string | mode | - | 指定插值方法,可选项包括:<br>**NEAREST**(最近邻插值,选取H和W维上最近的值);<br>**BILINEAR**(双线性插值,选取H和W维上相邻四个点做线性插值).<br>默认值BILINEAR | |
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.
bicubic
也是很常见的插值方法,麻烦也实现下吧~
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.
好的
|
||
|
||
# 四、对比分析 | ||
TVM 的 `resize2d` 算子实现详细,可作为参考。本次任务计划使用 custom call 实现 `resize` 算子,参考 [cholesky 算子的实现](https://github.com/PaddlePaddle/CINN/pull/1133)。 |
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.
te
对应的是CINN里的cinn ir
。如果没有像cublas、cudnn、cusolver这种第三方库提供类似函数的话,那就不能通过custom call的方式实现,而是得通过extern call的方式实现,参考PaddlePaddle/CINN#1018 。
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.
好的明白,修改为extern call的方式实现
|
||
**支持的数据类型:** | ||
|
||
`int32`、`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.
图片应该大部分是uint8
、int32
这种类型吧。。。
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/tests/ops/test_example_op.py` 中添加 `resize` 算子的测试。测试内容覆盖所有 resize 模式,数据类型。 |
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/tests/ops/test_resize_op.py
测试而非test_example_op.py
,覆盖支持的所有模式和数据类型,以及几个常见shape
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