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 4th No.83】为神经网络编译器 CINN 增加 resize 算子 #384

Merged
merged 2 commits into from
Mar 3, 2023
Merged

【Hackathon 4th No.83】为神经网络编译器 CINN 增加 resize 算子 #384

merged 2 commits into from
Mar 3, 2023

Conversation

MayYouBeProsperous
Copy link
Contributor

@MayYouBeProsperous MayYouBeProsperous commented Feb 26, 2023

@paddle-bot
Copy link

paddle-bot bot commented Feb 26, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请检查PR提交格式和内容是否完备,具体请参考示例模版
Your PR has been submitted. Thanks for your contribution!
Please check its format and content. For this, you can refer to Template and Demo.

@MayYouBeProsperous MayYouBeProsperous changed the title 【Hackathon 4 No.83】为神经网络编译器 CINN 增加 resize 算子 【Hackathon 4th No.83】为神经网络编译器 CINN 增加 resize 算子 Feb 27, 2023
| :-------: | :---------: | :-------: | :------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------: |
| 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 |
Copy link
Contributor

Choose a reason for hiding this comment

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

bicubic也是很常见的插值方法,麻烦也实现下吧~

Copy link
Contributor Author

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)。
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的明白,修改为extern call的方式实现


**支持的数据类型:**

`int32`、`float32`
Copy link
Contributor

@thisjiang thisjiang Feb 27, 2023

Choose a reason for hiding this comment

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

图片应该大部分是uint8int32这种类型吧。。。

Copy link
Contributor Author

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 模式,数据类型。
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的已修改

Copy link
Contributor

@thisjiang thisjiang left a comment

Choose a reason for hiding this comment

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

LGTM

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.

None yet

4 participants