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

[PHI] Code auto-generate for Sparse API #40060

Merged
merged 8 commits into from
Mar 3, 2022
Merged

Conversation

zyfncg
Copy link
Contributor

@zyfncg zyfncg commented Mar 2, 2022

PR types

New features

PR changes

APIs

Describe

Sparse API支持通过yaml配置完成接口代码的自动生成。
以sparse_conv3d为例,其yaml配置格式如下:

- sparse_api : conv3d
  args : (Tensor x, Tensor kernel, int[] paddings, int[] dilations, int[] strides, int groups)
  output : Tensor(out@SparseCooTensor), Tensor(rulebook@DenseTensor)
  kernel :
    func : sparse_conv3d

配置规则与普通API基本相同,区别在于:

  1. 无需配置infer_meta项
  2. output项中的变量名需使用 "@XXX" 的后缀标记返回Tensor的具体数据类型

@paddle-bot-old
Copy link

paddle-bot-old bot commented Mar 2, 2022

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@zyfncg zyfncg merged commit 31d3d85 into PaddlePaddle:develop Mar 3, 2022
@zyfncg zyfncg deleted the sparse_api branch March 3, 2022 03:19
std::make_shared<phi::SparseCsrTensor>(phi::DenseTensor(),
phi::DenseTensor(),
phi::DenseTensor(),
phi::DDim{-1});
Copy link
Contributor

Choose a reason for hiding this comment

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

这里是不是没有测试过,SparseCsrTensor 的构造函数内会检查 dims 的长度,只允许 2d 和 3d

Copy link
Contributor

Choose a reason for hiding this comment

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

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.

3 participants