sparse_bw_api.yaml 4.9 KB
Newer Older
1 2 3 4 5 6 7 8
- backward_api : add_grad
  forward : add(Tensor x, Tensor y) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out_grad)
  output : Tensor(x_grad), Tensor(y_grad)
  kernel :
    func : add_coo_coo_grad{sparse_coo, sparse_coo, sparse_coo -> sparse_coo, sparse_coo},
           add_csr_csr_grad{sparse_csr, sparse_csr, sparse_csr -> sparse_csr, sparse_csr}

9
- backward_api : conv3d_grad
Z
zhangkaihuo 已提交
10 11
  forward : conv3d (Tensor x, Tensor kernel, int[] paddings, int[] dilations, int[] strides, int groups, bool subm) -> Tensor(out@SparseCooTensor), Tensor(rulebook@DenseTensor)
  args : (Tensor x, Tensor kernel, Tensor rulebook, Tensor out_grad, int[] paddings, int[] dilations, int[] strides, int groups, bool subm)
12
  output : Tensor(x_grad), Tensor(kernel_grad)
13
  kernel :
14
    func : sparse_conv3d_grad{sparse_coo, dense, dense, sparse_coo -> sparse_coo, dense}
Z
zhangkaihuo 已提交
15

16
- backward_api : coo_to_dense_grad
17
  forward : coo_to_dense(Tensor x) -> Tensor(out)
18
  args : (Tensor x, Tensor out_grad)
19
  output : Tensor(x_grad)
20
  kernel :
21
    func : sparse_coo_to_dense_grad{sparse_coo, dense-> sparse_coo}
22

23
- backward_api : create_sparse_coo_tensor_grad
24
  forward : create_sparse_coo_tensor(Tensor values, Tensor indices, IntArray dense_shape) -> Tensor(out)
25
  args : (Tensor indices, Tensor out_grad)
26
  output : Tensor(values_grad)
27
  kernel :
28
    func : sparse_coo_tensor_grad{dense, sparse_coo -> dense}
29

30
- backward_api : dense_to_coo_grad
31
  forward : dense_to_coo(Tensor x, int64_t sparse_dim) -> Tensor(out)
32
  args : (Tensor out_grad)
33
  output : Tensor(x_grad)
34 35
  invoke : to_dense_impl(out_grad)

36 37 38 39 40 41 42 43
- backward_api : divide_grad
  forward : divide(Tensor x, Tensor y) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out, Tensor out_grad)
  output : Tensor(x_grad), Tensor(y_grad)
  kernel :
    func : divide_coo_coo_grad{sparse_coo, sparse_coo, sparse_coo, sparse_coo -> sparse_coo, sparse_coo},
           divide_csr_csr_grad{sparse_csr, sparse_csr, sparse_csr, sparse_csr -> sparse_csr, sparse_csr}

44 45 46 47 48 49 50 51 52 53 54 55 56 57
- backward_api : masked_matmul_grad
  forward : masked_matmul(Tensor x, Tensor y, Tensor mask) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out_grad)
  output : Tensor(x_grad), Tensor(y_grad)
  kernel :
    func : csr_masked_matmul_grad{dense, dense, sparse_csr -> dense, dense}

- backward_api : matmul_grad
  forward : matmul(Tensor x, Tensor y) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out_grad)
  output : Tensor(x_grad), Tensor(y_grad)
  kernel :
    func : csr_dense_matmul_grad{sparse_csr, dense, dense -> sparse_csr, dense}

58 59 60 61 62 63 64 65
- backward_api : multiply_grad
  forward : multiply(Tensor x, Tensor y) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out_grad)
  output : Tensor(x_grad), Tensor(y_grad)
  kernel :
    func : multiply_coo_coo_grad{sparse_coo, sparse_coo, sparse_coo -> sparse_coo, sparse_coo},
           multiply_csr_csr_grad{sparse_csr, sparse_csr, sparse_csr -> sparse_csr, sparse_csr}

66 67
- backward_api : relu_grad
  forward : relu(Tensor x) -> Tensor(out)
68
  args : (Tensor out, Tensor out_grad)
69
  output : Tensor(x_grad)
Z
zhangkaihuo 已提交
70
  kernel :
71
    func : sparse_coo_relu_grad {sparse_coo, sparse_coo -> sparse_coo}
Z
zhangkaihuo 已提交
72

73 74
- backward_api : sin_grad
  forward : sin(Tensor x) -> Tensor(out)
Z
zhangkaihuo 已提交
75
  args : (Tensor x, Tensor out_grad)
76 77 78 79
  output : Tensor(x_grad)
  kernel :
    func : sparse_coo_sin_grad {sparse_coo, sparse_coo -> sparse_coo}

80 81 82 83 84 85 86
- backward_api : softmax_grad
  forward : softmax(Tensor x, int axis=-1) -> Tensor(out)
  args : (Tensor out, Tensor out_grad, int axis)
  output : Tensor(x_grad)
  kernel :
    func : softmax_csr_grad{sparse_csr, sparse_csr -> sparse_csr}

87 88 89 90
- backward_api : sparse_maxpool_grad
  forward : sparse_maxpool(Tensor x, int[] kernel_sizes, int[] paddings, int[] dilations, int[] strides) -> Tensor(out), Tensor(rulebook)
  args : (Tensor x, Tensor rulebook, Tensor out, Tensor out_grad, int[] kernel_sizes)
  output : Tensor(x_grad)
Z
zyfncg 已提交
91
  kernel :
92
    func : sparse_maxpool_grad {sparse_coo, dense, sparse_coo, sparse_coo -> sparse_coo}
93

94 95
- backward_api : sqrt_grad
  forward : sqrt(Tensor x) -> Tensor(out)
96
  args : (Tensor out, Tensor out_grad)
97
  output : Tensor(x_grad)
98
  kernel :
99
    func : sparse_coo_sqrt_grad {sparse_coo, sparse_coo -> sparse_coo}
100

101 102 103 104 105 106 107 108
- backward_api : subtract_grad
  forward : subtract(Tensor x, Tensor y) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out_grad)
  output : Tensor(x_grad), Tensor(y_grad)
  kernel :
    func : subtract_coo_coo_grad{sparse_coo, sparse_coo, sparse_coo -> sparse_coo, sparse_coo},
           subtract_csr_csr_grad{sparse_csr, sparse_csr, sparse_csr -> sparse_csr, sparse_csr}

109 110
- backward_api : tanh_grad
  forward : tanh(Tensor x) -> Tensor(out)
111
  args : (Tensor out, Tensor out_grad)
112
  output : Tensor(x_grad)
113
  kernel :
114
    func : sparse_coo_tanh_grad {sparse_coo, sparse_coo -> sparse_coo}
115

116 117 118 119
- backward_api : values_grad
  forward : coo_values(Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
120
  kernel :
121
    func : coo_values_grad{sparse_coo, dense-> sparse_coo}