Skip to content

Conversation

@zyfncg
Copy link
Contributor

@zyfncg zyfncg commented Mar 6, 2022

PR types

New features

PR changes

APIs

Describe

Sparse backward API支持通过Yaml配置完成接口代码的自动生成。Sparse 前向API可参考#PR40060

以sparse_conv3d_grad为例,其yaml配置格式如下:

- sparse_bw_api : conv3d_grad forward : conv3d (Tensor x, Tensor kernel, int[] paddings, int[] dilations, int[] strides, int groups) -> Tensor(out@SparseCooTensor), Tensor(rulebook@DenseTensor) args : (Tensor x, Tensor kernel, Tensor rulebook, Tensor out_grad, int[] paddings, int[] dilations, int[] strides, int groups) output : Tensor(x_grad@DenseTensor), Tensor(kernel_grad@DenseTensor) kernel : func : sparse_conv_grad 

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

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

paddle-bot-old bot commented Mar 6, 2022

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

@zyfncg zyfncg merged commit f876320 into PaddlePaddle:develop Mar 8, 2022
@zyfncg zyfncg deleted the sparse_bw_api branch March 8, 2022 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants