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

Add Sparse op sparse_relu #40959

Merged
merged 7 commits into from
Mar 29, 2022
Merged

Add Sparse op sparse_relu #40959

merged 7 commits into from
Mar 29, 2022

Conversation

zkh2016
Copy link
Contributor

@zkh2016 zkh2016 commented Mar 25, 2022

PR types

New features

PR changes

OPs

Describe

  1. 添加sparse op:sparse_relu。
  2. to_string.py : 修改tensor是否初始化的判断,支持SparseTensor。
  3. CMakeLists把sparse_kernel改成sparse

@paddle-bot-old
Copy link

paddle-bot-old bot commented Mar 25, 2022

✅ This PR's description meets the template requirements!
Please wait for other CI results.

@paddle-bot-old
Copy link

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

xingfeng01
xingfeng01 previously approved these changes Mar 28, 2022
SparseCooTensor* out);

template <typename T, typename Context>
SparseCooTensor SparseRelu(const Context& dev_ctx, const SparseCooTensor& x) {
Copy link
Contributor

Choose a reason for hiding this comment

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

在 C++ 层实现的是吗 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

是的,这里不能直接在前端通过SparseCooTensor的values熟悉来调用dense的relu的原因主要是:1. SparseCooTensor是在后端进行封装的,2. 动态图的autograd属性在API Tensor中,不在后端的DenseTensor里。

Copy link
Contributor

@Aurelius84 Aurelius84 left a comment

Choose a reason for hiding this comment

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

LGTM for CMakeList.txt

See the License for the specific language governing permissions and
limitations under the License. */

#include "paddle/phi/kernels/sparse/sparse_activation_grad_kernel.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

这个文件命名是不是有点冗余,sparse目录下,还需要sparse_的前缀吗

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的,我下一个PR里进行优化。

@zkh2016 zkh2016 merged commit c544a18 into PaddlePaddle:develop Mar 29, 2022
@zkh2016 zkh2016 deleted the sparse_relu branch August 19, 2022 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants