legacy_backward.yaml 31.8 KB
Newer Older
1
- backward_op : add_double_grad
Z
zyfncg 已提交
2 3 4 5 6 7 8 9 10
  forward : add_grad (Tensor x, Tensor y, Tensor grad_out, int axis = -1) -> Tensor(grad_x), Tensor(grad_y)
  args : (Tensor y, Tensor grad_out, Tensor grad_x_grad, Tensor grad_y_grad, int axis = -1)
  output : Tensor(grad_out_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [grad_out]
  kernel :
    func : add_double_grad
  optional : grad_x_grad, grad_y_grad
11
  backward : add_triple_grad
Z
zyfncg 已提交
12
  inplace : (grad_x_grad -> grad_out_grad)
13
  composite : add_double_grad(y, grad_out, grad_x_grad, grad_y_grad, axis, grad_out_grad)
Z
zyfncg 已提交
14

15
- backward_op : add_grad
Z
zyfncg 已提交
16 17 18 19 20 21 22 23 24
  forward : add (Tensor x, Tensor y) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out_grad, int axis = -1)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : add_grad
  no_need_buffer : x, y
25
  composite : add_grad(x, y, out_grad, axis, x_grad, y_grad)
Z
zyfncg 已提交
26 27 28
  backward : add_double_grad
  inplace : (out_grad -> x_grad)

29 30 31 32 33 34 35 36 37 38
- backward_op : add_triple_grad
  forward : add_double_grad (Tensor y, Tensor grad_out, Tensor grad_grad_x, Tensor grad_grad_y, int axis = -1) -> Tensor(grad_grad_out)
  args : (Tensor grad_grad_x, Tensor grad_grad_y, Tensor grad_grad_out_grad, int axis = -1)
  output : Tensor(grad_grad_x_grad), Tensor(grad_grad_y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [grad_grad_x, grad_grad_y]
  kernel :
    func : add_triple_grad
  inplace : (grad_grad_out_grad -> grad_grad_x_grad)
39
  composite : add_triple_grad (grad_grad_x, grad_grad_y, grad_grad_out_grad, axis, grad_grad_x_grad, grad_grad_y_grad )
40

41
- backward_op : amax_grad
42 43
  forward: amax (Tensor x,  int64_t[] axis={},  bool keepdim=false) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, int64_t[] axis={},  bool keepdim=false, bool reduce_all=false)
44 45 46 47 48 49 50
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : amax_grad

51
- backward_op : amin_grad
52 53
  forward: amin (Tensor x,  int64_t[] axis={},  bool keepdim=false) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, int64_t[] axis={},  bool keepdim=false, bool reduce_all=false)
54 55 56 57 58 59 60
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : amin_grad

61
- backward_op : assign_grad
Z
zyfncg 已提交
62 63 64
  forward : assign (Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
65
  composite: assign_grad(out_grad, x_grad)
66
  invoke : assign(out_grad)
Z
zyfncg 已提交
67

68
- backward_op : assign_out__grad
Z
zyfncg 已提交
69 70 71 72 73 74 75 76 77
  forward : assign_out_ (Tensor x, Tensor output) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
  kernel :
    func : assign
  inplace : (out_grad -> x_grad)

78
- backward_op : batch_norm_double_grad
79 80
  forward : batch_norm_grad (Tensor x, Tensor scale, Tensor bias, Tensor out_mean, Tensor out_variance, Tensor saved_mean, Tensor saved_variance, Tensor reserve_space, Tensor grad_out, float momentum, float epsilon, str data_layout, bool is_test, bool use_global_stats, bool trainable_statistics) -> Tensor(grad_x), Tensor(grad_scale), Tensor(grad_bias)
  args : (Tensor x, Tensor scale, Tensor out_mean, Tensor out_variance, Tensor saved_mean, Tensor saved_variance, Tensor grad_out,  Tensor grad_x_grad, Tensor grad_scale_grad, Tensor grad_bias_grad, float momentum, float epsilon, str data_layout, bool is_test, bool use_global_stats, bool trainable_statistics)
Z
zyfncg 已提交
81 82 83 84 85
  output : Tensor(x_grad), Tensor(scale_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param : [x, scale, x]
  kernel :
86
    func : batch_norm_double_grad
Z
zyfncg 已提交
87
    data_type : x
88
  optional : out_mean, out_variance, grad_x_grad, grad_scale_grad, grad_bias_grad
Z
zyfncg 已提交
89 90
  inplace : (grad_out -> grad_out_grad)

91
- backward_op : batch_norm_grad
92 93
  forward : batch_norm (Tensor x, Tensor mean, Tensor variance, Tensor scale, Tensor bias, bool is_test, float momentum, float epsilon, str data_layout, bool use_global_stats, bool trainable_statistics) -> Tensor(out), Tensor(mean_out), Tensor(variance_out), Tensor(saved_mean), Tensor(saved_variance), Tensor(reserve_space)
  args : (Tensor x, Tensor scale, Tensor bias, Tensor mean_out, Tensor variance_out, Tensor saved_mean, Tensor saved_variance, Tensor reserve_space, Tensor out_grad, float momentum, float epsilon, str data_layout, bool is_test, bool use_global_stats, bool trainable_statistics)
Z
zyfncg 已提交
94 95 96 97 98 99 100 101
  output : Tensor(x_grad), Tensor(scale_grad), Tensor(bias_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param : [x, scale, bias]
  kernel :
    func : batch_norm_grad
    data_type : out_grad
  optional : mean_out, variance_out, reserve_space
102
  composite: batch_norm_grad(x, scale, bias, mean_out, variance_out, saved_mean, saved_variance, reserve_space, out_grad, momentum, epsilon, data_layout, is_test, use_global_stats, trainable_statistics)
Z
zyfncg 已提交
103 104
  backward : batch_norm_double_grad

105
- backward_op : cast_grad
106
  forward : cast (Tensor x, DataType dtype) -> Tensor(out)
Z
zyfncg 已提交
107 108
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
109
  invoke : cast (out_grad, x.dtype())
110
  composite: cast_grad(x, out_grad, x_grad)
Z
zyfncg 已提交
111 112
  no_need_buffer : x

113 114 115 116 117 118 119 120 121
- backward_op : channel_shuffle_grad
  forward : channel_shuffle (Tensor x, int groups, str data_format="NCHW") -> Tensor(out)
  args : (Tensor out_grad, int groups, str data_format="NCHW")
  output : Tensor(x_grad)
  infer_meta :
    func : ChannelShuffleGradInferMeta
  kernel :
    func : channel_shuffle_grad

122
- backward_op : conv2d_transpose_double_grad
123 124
  forward : conv2d_transpose_grad(Tensor x, Tensor filter, Tensor grad_out, int[] strides, int[] paddings, int[] output_padding, IntArray output_size, str padding_algorithm, int groups, int[] dilations, str data_format) -> Tensor(grad_x), Tensor(grad_filter)
  args : (Tensor x, Tensor filter, Tensor grad_out, Tensor grad_x_grad, Tensor grad_filter_grad, int[] strides, int[] paddings, int[] output_padding, IntArray output_size, str padding_algorithm, int groups, int[] dilations, str data_format)
Z
zyfncg 已提交
125 126 127 128
  output : Tensor(x_grad), Tensor(filter_grad), Tensor(grad_out_grad)
  infer_meta :
    func : Conv2dTransposeDoubleGradInferMeta
  kernel :
129
    func : conv2d_transpose_double_grad
130
    data_type : x
Z
zyfncg 已提交
131

132
- backward_op : conv2d_transpose_grad
133
  forward : conv2d_transpose(Tensor x, Tensor filter, int[] strides={1, 1}, int[] paddings={0, 0}, int[] output_padding={}, IntArray output_size={}, str padding_algorithm="EXPLICIT", int groups=1, int[] dilations={1, 1}, str data_format="NCHW") -> Tensor(out)
134
  args : (Tensor x, Tensor filter, Tensor out_grad, int[] strides, int[] paddings, int[] output_padding, IntArray output_size, str padding_algorithm, int groups, int[] dilations, str data_format)
Z
zyfncg 已提交
135 136
  output : Tensor(x_grad), Tensor(filter_grad)
  infer_meta :
137
    func : Conv2dTransposeGradInferMeta
Z
zyfncg 已提交
138 139
  kernel :
    func : conv2d_transpose_grad
140
    data_type : x
Z
zyfncg 已提交
141 142
  backward : conv2d_transpose_double_grad

143
- backward_op : deformable_conv_grad
Z
zyfncg 已提交
144 145 146 147 148 149 150 151 152 153
  forward : deformable_conv(Tensor x, Tensor offset, Tensor filter, Tensor mask, int[] strides, int[] paddings, int[] dilations, int deformable_groups, int groups, int im2col_step) -> Tensor(out)
  args : (Tensor x, Tensor offset, Tensor filter, Tensor mask, Tensor out_grad, int[] strides, int[] paddings, int[] dilations, int deformable_groups, int groups, int im2col_step)
  output : Tensor(x_grad), Tensor(offset_grad), Tensor(filter_grad), Tensor(mask_grad)
  infer_meta :
    func : DeformableConvGradInferMeta
  kernel :
    func : deformable_conv_grad
    data_type : x
  optional : mask

154
- backward_op : depthwise_conv2d_transpose_grad
155
  forward : depthwise_conv2d_transpose(Tensor x, Tensor filter, int[] strides={1, 1}, int[] paddings={0, 0}, int[] output_padding={}, IntArray output_size={}, str padding_algorithm="EXPLICIT", int groups=1, int[] dilations={1, 1}, str data_format="NCHW") -> Tensor(out)
156
  args : (Tensor x, Tensor filter, Tensor out_grad, int[] strides, int[] paddings, int[] output_padding, IntArray output_size, str padding_algorithm, int groups, int[] dilations, str data_format)
Z
zyfncg 已提交
157 158
  output : Tensor(x_grad), Tensor(filter_grad)
  infer_meta :
159
    func : Conv2dTransposeGradInferMeta
Z
zyfncg 已提交
160 161
  kernel :
    func : depthwise_conv2d_transpose_grad
162
    data_type : x
Z
zyfncg 已提交
163

164
- backward_op : divide_double_grad
Z
zyfncg 已提交
165 166 167 168 169 170 171 172 173 174 175 176
  forward : divide_grad (Tensor x, Tensor y, Tensor out, Tensor grad_out, int axis = -1) -> Tensor(grad_x), Tensor(grad_y)
  args : (Tensor y, Tensor out, Tensor grad_x, Tensor grad_x_grad, Tensor grad_y_grad, int axis = -1)
  output : Tensor(y_grad), Tensor(out_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param : [y, grad_x, grad_x]
  kernel :
    func : divide_double_grad
    data_type : out
  optional : grad_x_grad, grad_y_grad
  inplace : (grad_x_grad -> grad_out_grad)

177
- backward_op : divide_grad
Z
zyfncg 已提交
178 179 180 181 182 183 184 185
  forward : divide (Tensor x, Tensor y) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out, Tensor out_grad, int axis = -1)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : divide_grad
186
  composite : divide_grad(x, y, out, out_grad, axis, x_grad, y_grad)
Z
zyfncg 已提交
187 188
  backward : divide_double_grad

189
- backward_op : dropout_grad
190 191
  forward : dropout (Tensor x, Tensor seed_tensor, Scalar p, bool is_test, str mode, int seed, bool fix_seed) -> Tensor(out), Tensor(mask)
  args : (Tensor mask, Tensor out_grad, Scalar p, bool is_test, str mode)
Z
zyfncg 已提交
192 193 194 195 196 197 198
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out_grad]
  kernel :
    func : dropout_grad

199
- backward_op : einsum_grad
Z
zyfncg 已提交
200 201
  forward : einsum (Tensor[] x, str equation) -> Tensor(out), Tensor[](inner_cache), Tensor[](x_shape)
  args : (Tensor[] x_shape, Tensor[] inner_cache, Tensor out_grad, str equation)
202
  output : Tensor[](x_grad){x_shape.size()}
Z
zyfncg 已提交
203 204 205 206 207 208
  infer_meta :
    func : UnchangedMultiInferMeta
    param : [x_shape]
  kernel :
    func : einsum_grad

209
- backward_op : elementwise_pow_grad
Z
zyfncg 已提交
210
  forward : elementwise_pow(Tensor x, Tensor y) -> Tensor(out)
211
  args : (Tensor x, Tensor y, Tensor out_grad)
Z
zyfncg 已提交
212 213 214 215
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param: [x, y]
216
  composite : elementwise_pow_grad(x, y, out_grad, axis, x_grad, y_grad)
Z
zyfncg 已提交
217 218 219
  kernel :
    func : elementwise_pow_grad

220
- backward_op : embedding_grad
Z
zyfncg 已提交
221 222 223 224
  forward : embedding (Tensor x, Tensor weight, int64_t padding_idx=-1, bool sparse=false) -> Tensor(out)
  args : (Tensor x, Tensor weight, Tensor out_grad, int64_t padding_idx=-1, bool sparse=false)
  output : Tensor(weight_grad)
  invoke : embedding_grad_impl(x, weight, out_grad, padding_idx, sparse, weight_grad)
W
wanghuancoder 已提交
225
  no_need_buffer : weight
Z
zyfncg 已提交
226

227
- backward_op : exponential__grad
228
  forward : exponential_ (Tensor x, float lam) -> Tensor(out)
229 230 231 232
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
233
  invoke : zeros_like(out_grad)
234

235
- backward_op : frobenius_norm_grad
Z
zyfncg 已提交
236 237 238 239 240 241 242 243 244
  forward : frobenius_norm(Tensor x, int64_t[] axis,  bool keep_dim,  bool reduce_all) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, int64_t[] axis,  bool keep_dim,  bool reduce_all)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : frobenius_norm_grad

245
- backward_op : hardswish_grad
246
  forward : hardswish (Tensor x) -> Tensor(out)
247
  args : (Tensor x, Tensor out_grad)
Z
zyfncg 已提交
248 249 250 251 252
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
Z
zyfncg 已提交
253
    func : hardswish_grad
Z
zyfncg 已提交
254 255
  inplace : (out_grad -> x_grad)

256
- backward_op : hsigmoid_loss_grad
Z
zhangyuqin1998 已提交
257 258
  forward : hsigmoid_loss (Tensor x, Tensor label, Tensor w, Tensor bias, Tensor path, Tensor code, int num_classes, bool is_sparse) -> Tensor(out), Tensor(pre_out), Tensor(w_out)
  args : (Tensor x, Tensor w, Tensor label, Tensor path, Tensor code, Tensor bias, Tensor pre_out, Tensor out_grad, int num_classes, bool is_sparse)
259 260 261 262 263 264
  output : Tensor(x_grad), Tensor(w_grad), Tensor(bias_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param : [x ,w, bias]
  optional: path, code, bias
  kernel :
265
    func : hsigmoid_loss_grad
266

267
- backward_op : logsumexp_grad
Z
zyfncg 已提交
268 269 270 271 272 273 274 275 276
  forward : logsumexp(Tensor x, int64_t[] axis,  bool keepdim,  bool reduce_all) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, int64_t[] axis,  bool keepdim,  bool reduce_all)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : logsumexp_grad

277
- backward_op : matmul_double_grad
Z
zyfncg 已提交
278 279 280 281 282 283 284 285
  forward : matmul_grad (Tensor x, Tensor y, Tensor grad_out, bool transpose_x=false, bool transpose_y=false) -> Tensor(grad_x), Tensor(grad_y)
  args : (Tensor x, Tensor y, Tensor grad_out, Tensor grad_x_grad, Tensor grad_y_grad, bool transpose_x=false, bool transpose_y=false)
  output : Tensor(x_grad), Tensor(y_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param : [x, y, grad_out]
  kernel :
    func : matmul_double_grad
286
  composite : matmul_double_grad(x, y, grad_out, grad_x_grad, grad_y_grad, transpose_x=false, transpose_y=false)
Z
zyfncg 已提交
287 288
  optional : grad_x_grad, grad_y_grad

289
- backward_op : matmul_grad
Z
zyfncg 已提交
290 291 292 293 294 295 296 297 298 299
  forward : matmul (Tensor x, Tensor y, bool transpose_x=false, bool transpose_y=false) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out_grad, bool transpose_x=false, bool transpose_y=false)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : matmul_grad
  backward : matmul_double_grad

300
- backward_op : max_grad
301 302
  forward: max (Tensor x,  IntArray axis={},  bool keepdim=false) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, IntArray axis={}, bool keepdim=false, bool reduce_all=false)
Z
zyfncg 已提交
303 304 305 306 307 308
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : max_grad
309
  composite : max_grad(x, out, out_grad, axis, keepdim, reduce_all, x_grad)
Z
zyfncg 已提交
310

311
- backward_op : maximum_grad
Z
zyfncg 已提交
312
  forward : maximum(Tensor x, Tensor y) -> Tensor(out)
313
  args : (Tensor x, Tensor y, Tensor out_grad)
Z
zyfncg 已提交
314 315 316 317 318 319
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param: [x, y]
  kernel :
    func : maximum_grad
H
heyanru 已提交
320
  composite : maximum_grad(x, y, out_grad, axis, x_grad, y_grad)
Z
zyfncg 已提交
321

322
- backward_op : mean_double_grad
323 324
  forward: mean_grad (Tensor x, Tensor grad_out, IntArray axis={},  bool keepdim=false, bool reduce_all = false) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, IntArray axis={},  bool keepdim=false)
Z
zyfncg 已提交
325
  output : Tensor(grad_out_grad)
326
  invoke : mean(grad_x_grad, axis, keepdim)
Z
zyfncg 已提交
327

328
- backward_op : mean_grad
329 330
  forward: mean (Tensor x,  IntArray axis={},  bool keepdim=false) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, IntArray axis={},  bool keepdim=false, bool reduce_all=false)
Z
zyfncg 已提交
331 332 333 334 335 336 337 338 339
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : mean_grad
  backward : mean_double_grad
  no_need_buffer : x

340
- backward_op : min_grad
341 342
  forward: min (Tensor x,  IntArray axis={},  bool keepdim=false) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, IntArray axis={}, bool keepdim=false, bool reduce_all=false)
Z
zyfncg 已提交
343 344 345 346 347 348 349
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : min_grad

350
- backward_op : minimum_grad
Z
zyfncg 已提交
351
  forward : minimum(Tensor x, Tensor y) -> Tensor(out)
352
  args : (Tensor x, Tensor y, Tensor out_grad)
Z
zyfncg 已提交
353 354 355 356 357 358
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param: [x, y]
  kernel :
    func : minimum_grad
359
  composite : minimum_grad(x, y, out_grad, axis, x_grad, y_grad)
Z
zyfncg 已提交
360

361
- backward_op : mish_grad
Z
zyfncg 已提交
362 363 364 365 366 367 368 369 370 371
  forward : mish (Tensor x, float threshold) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, float threshold)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : mish_grad
  inplace : (out_grad -> x_grad)

372
- backward_op : multiply_double_grad
Z
zyfncg 已提交
373 374 375 376 377 378 379 380 381 382
  forward : multiply_grad (Tensor x, Tensor y, Tensor grad_out, int axis = -1) -> Tensor(grad_x), Tensor(grad_y)
  args : (Tensor x, Tensor y, Tensor grad_out, Tensor grad_x_grad, Tensor grad_y_grad, int axis = -1)
  output : Tensor(x_grad), Tensor(y_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param : [x, y, grad_out]
  kernel :
    func : multiply_double_grad
  optional : grad_x_grad, grad_y_grad
  inplace : (grad_x_grad -> grad_out_grad)
X
xiaoguoguo626807 已提交
383
  backward : multiply_triple_grad
384
  composite : multiply_double_grad(x, y, grad_out, grad_x_grad, grad_y_grad, axis, x_grad, y_grad, grad_out_grad)
Z
zyfncg 已提交
385

386
- backward_op : multiply_grad
Z
zyfncg 已提交
387 388 389 390 391 392 393 394
  forward : multiply (Tensor x, Tensor y) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out_grad, int axis = -1)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : multiply_grad
395
  composite: multiply_grad(x, y, out_grad, axis, x_grad, y_grad)
Z
zyfncg 已提交
396 397
  backward : multiply_double_grad

X
xiaoguoguo626807 已提交
398 399 400 401 402 403 404 405 406 407 408
- backward_op : multiply_triple_grad
  forward : multiply_double_grad (Tensor x, Tensor y, Tensor fwd_grad_out, Tensor fwd_grad_grad_x, Tensor fwd_grad_grad_y, int aixs = -1) -> Tensor(grad_x), Tensor(grad_y), Tensor(grad_grad_out)
  args : (Tensor x, Tensor y, Tensor fwd_grad_out, Tensor fwd_grad_grad_x, Tensor fwd_grad_grad_y, Tensor grad_x_grad, Tensor grad_y_grad, Tensor grad_grad_out_grad, int axis = -1)
  output : Tensor(x_grad), Tensor(y_grad), Tensor(fwd_grad_out_grad), Tensor(fwd_grad_grad_x_grad), Tensor(fwd_grad_grad_y_grad)
  infer_meta :
    func : GeneralQuinaryGradInferMeta
    param : [x, y, fwd_grad_out, fwd_grad_grad_x, fwd_grad_grad_y]
  kernel :
    func : multiply_triple_grad
  optional : fwd_grad_grad_x, fwd_grad_grad_y, grad_x_grad, grad_y_grad, grad_grad_out_grad

409
- backward_op : norm_grad
Z
zyfncg 已提交
410 411 412 413 414 415 416 417 418
  forward : norm (Tensor x, int axis, float epsilon, bool is_test) -> Tensor(out), Tensor(norm)
  args : (Tensor x, Tensor norm, Tensor out_grad, int axis, float epsilon, bool is_test)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : norm_grad

419
- backward_op : pad_double_grad
420 421
  forward : pad_grad(Tensor x, Tensor grad_out, int[] paddings, Scalar pad_value) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, int[] paddings, Scalar pad_value)
Z
zyfncg 已提交
422 423 424 425 426 427
  output : Tensor(grad_out_grad)
  infer_meta :
    func : PadInferMeta
  kernel :
    func : pad

428
- backward_op : pad_grad
429 430
  forward : pad(Tensor x, int[] paddings, Scalar pad_value) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, int[] paddings, Scalar pad_value)
Z
zyfncg 已提交
431 432 433 434 435 436 437 438
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : pad_grad
    param: [out_grad, paddings, pad_value]
  no_need_buffer : x
M
mengziheng 已提交
439
  composite : pad_grad(x, out_grad, paddings, pad_value, x_grad)
Z
zyfncg 已提交
440 441
  backward : pad_double_grad

442
- backward_op : pool2d_double_grad
443 444
  forward : pool2d_grad(Tensor x, Tensor out, Tensor grad_out, IntArray kernel_size, int[] strides, int[] paddings, bool ceil_mode, bool exclusive, str data_format, str pooling_type, bool global_pooling, bool adaptive, str padding_algorithm) -> Tensor(grad_x)
  args : (Tensor x, Tensor grad_x_grad, IntArray kernel_size, int[] strides, int[] paddings, bool ceil_mode, bool exclusive, str data_format, str pooling_type, bool global_pooling, bool adaptive, str padding_algorithm)
Z
zyfncg 已提交
445 446
  output : Tensor(grad_out_grad)
  infer_meta :
447
    func : Pool2DInferMeta
448
    param : [grad_x_grad, kernel_size, strides, paddings, ceil_mode, exclusive, data_format, pooling_type, global_pooling, adaptive, padding_algorithm]
Z
zyfncg 已提交
449 450
  kernel :
    func : pool2d_double_grad
451
    param : [grad_x_grad, kernel_size, strides, paddings, ceil_mode, exclusive, data_format, pooling_type, global_pooling, adaptive, padding_algorithm]
452
  no_need_buffer : x
Z
zyfncg 已提交
453

454
- backward_op : pool2d_grad
455 456
  forward : pool2d(Tensor x, IntArray kernel_size, int[] strides, int[] paddings, bool ceil_mode, bool exclusive, str data_format, str pooling_type, bool global_pooling, bool adaptive, str padding_algorithm) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, IntArray kernel_size, int[] strides, int[] paddings, bool ceil_mode, bool exclusive, str data_format, str pooling_type, bool global_pooling, bool adaptive, str padding_algorithm)
Z
zyfncg 已提交
457 458
  output : Tensor(x_grad)
  infer_meta :
459 460
    func : UnchangedInferMeta
    param: [x]
Z
zyfncg 已提交
461 462
  kernel :
    func : pool2d_grad
463
    param : [x, out, out_grad, kernel_size, strides, paddings, ceil_mode, exclusive, data_format, pooling_type, global_pooling, adaptive, padding_algorithm]
Z
zyfncg 已提交
464 465
  backward : pool2d_double_grad

466
- backward_op : pool3d_grad
467 468
  forward : pool3d(Tensor x, int[] kernel_size, int[] strides, int[] paddings, bool ceil_mode, bool exclusive, str data_format, str pooling_type, bool global_pooling, bool adaptive, str padding_algorithm) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, int[] kernel_size, int[] strides, int[] paddings, bool ceil_mode, bool exclusive, str data_format, str pooling_type, bool global_pooling, bool adaptive, str padding_algorithm)
Z
zyfncg 已提交
469 470
  output : Tensor(x_grad)
  infer_meta :
471 472
    func : UnchangedInferMeta
    param: [x]
Z
zyfncg 已提交
473 474
  kernel :
    func : pool3d_grad
475
    param : [x, out, out_grad, kernel_size, strides, paddings, ceil_mode, exclusive, data_format, pooling_type, global_pooling, adaptive, padding_algorithm]
Z
zyfncg 已提交
476

477 478 479 480 481 482 483 484 485
- backward_op : prod_grad
  forward : prod (Tensor x, IntArray dims, bool keep_dim, bool reduce_all) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, IntArray dims,  bool keep_dim, bool reduce_all)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : prod_grad
486
  composite: prod_grad(x, out, out_grad, dims, keep_dim, reduce_all, x_grad)
487

488
- backward_op : relu6_grad
489
  forward : relu6 (Tensor x) -> Tensor(out)
490
  args : (Tensor out, Tensor out_grad)
491 492 493 494 495 496 497 498
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : relu6_grad
  inplace : (out_grad -> x_grad)

499
- backward_op : repeat_interleave_grad
500 501
  forward : repeat_interleave(Tensor x, int repeats, int axis) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, int repeats, int axis)
S
seemingwang 已提交
502 503 504 505 506 507 508
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : repeat_interleave_grad

509
- backward_op : repeat_interleave_with_tensor_index_grad
510 511
  forward : repeat_interleave_with_tensor_index(Tensor x, Tensor repeats, int axis) -> Tensor(out)
  args : (Tensor x, Tensor repeats, Tensor out_grad, int axis)
S
seemingwang 已提交
512 513 514 515 516 517 518 519
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : repeat_interleave_with_tensor_index_grad
    data_type : x

520
- backward_op : reshape_double_grad
Z
zyfncg 已提交
521 522 523 524 525 526 527 528 529 530 531
  forward : reshape_grad (Tensor xshape, Tensor grad_out) -> Tensor(grad_x)
  args : (Tensor grad_out, Tensor grad_x_grad)
  output : Tensor(grad_out_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [grad_out]
  kernel :
    func : reshape_double_grad
  no_need_buffer : grad_out
  inplace : (grad_x_grad -> grad_out_grad)

532
- backward_op : reshape_grad
Z
zyfncg 已提交
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547
  forward : reshape (Tensor x, IntArray shape) -> Tensor(out), Tensor(xshape)
  args : (Tensor xshape, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : KernelWithXShapeInferMeta
    param : [xshape]
  kernel :
    func : reshape_grad
    param : [out_grad]
    data_type: out_grad
    backend: out_grad
    layout: out_grad
  backward : reshape_double_grad
  inplace : (out_grad -> x_grad)

Y
YuanRisheng 已提交
548 549 550 551 552 553 554 555 556 557 558 559
- backward_op : rnn_grad
  forward : rnn (Tensor x, Tensor[] pre_state, Tensor[] weight_list, Tensor sequence_length, Tensor dropout_state_in, float dropout_prob, bool is_bidirec, int input_size, int hidden_size, int num_layers, str mode, int seed, bool is_test) -> Tensor(out), Tensor(dropout_state_out), Tensor[](state), Tensor(reserve)
  args : (Tensor x, Tensor[] pre_state, Tensor[] weight_list, Tensor sequence_length, Tensor out, Tensor dropout_state_out, Tensor reserve, Tensor out_grad, Tensor[] state_grad, float dropout_prob, bool is_bidirec, int input_size, int hidden_size, int num_layers, str mode, int seed, bool is_test)
  output : Tensor(x_grad), Tensor[](pre_state_grad){pre_state.size()}, Tensor[](weight_list_grad){weight_list.size()}
  infer_meta :
    func : RnnGradInferMeta
    param : [x, pre_state, weight_list]
  kernel :
    func : rnn_grad
    data_type: out_grad
  optional : sequence_length

W
Weilong Wu 已提交
560 561 562 563 564 565 566 567 568 569 570
- backward_op : rrelu_grad
  forward : rrelu (Tensor x, float lower, float upper, bool is_test) -> Tensor(out), Tensor(noise)
  args : (Tensor x, Tensor noise, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : RReluGradInferMeta
    param : [out_grad, noise]
  kernel :
    func : rrelu_grad
    data_type : x

571
- backward_op : slice_double_grad
572 573 574
  forward : slice_grad (Tensor input, Tensor grad_out, int64_t[] axes, IntArray starts, IntArray ends, int64_t[] infer_flags, int64_t[] decrease_axis) -> Tensor(grad_input)
  args : (Tensor grad_input_grad, int64_t[] axes, IntArray starts, IntArray ends, int64_t[] infer_flags, int64_t[] decrease_axis)
  output : Tensor(grad_out_grad)
575
  invoke : slice(grad_input_grad, axes, starts, ends, infer_flags, decrease_axis)
576

577
- backward_op : slice_grad
Z
zyfncg 已提交
578 579 580 581 582 583 584 585
  forward : slice (Tensor input, int64_t[] axes, IntArray starts, IntArray ends, int64_t[] infer_flags, int64_t[] decrease_axis) -> Tensor(out)
  args : (Tensor input, Tensor out_grad, int64_t[] axes, IntArray starts, IntArray ends, int64_t[] infer_flags, int64_t[] decrease_axis)
  output : Tensor(input_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [input]
  kernel :
    func : slice_grad
586
  composite: slice_grad(input, out_grad, axes, starts, ends, infer_flags, decrease_axis, input_grad)
587
  backward : slice_double_grad
Z
zyfncg 已提交
588 589
  no_need_buffer : input

590
- backward_op : softmax_grad
Z
zyfncg 已提交
591 592 593 594 595 596 597 598
  forward : softmax (Tensor x, int axis) -> Tensor(out)
  args : (Tensor out, Tensor out_grad, int axis)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : softmax_grad
599
  composite : softmax_grad(out, out_grad, axis, x_grad)
Z
zyfncg 已提交
600

601
- backward_op : split_grad
Z
zyfncg 已提交
602 603 604 605
  forward : split (Tensor x, IntArray num_or_sections, Scalar axis) -> Tensor[](out)
  args : (Tensor[] out_grad, Scalar axis = -1)
  output : Tensor(x_grad)
  invoke : concat( out_grad, axis)
606
  composite : split_grad(out_grad, axis, x_grad)
C
Charles-hit 已提交
607

608
- backward_op : split_with_num_grad
C
Charles-hit 已提交
609 610 611 612
  forward : split_with_num (Tensor x, int num, Scalar axis) -> Tensor[](out)
  args : (Tensor[] out_grad, Scalar axis = -1)
  output : Tensor(x_grad)
  invoke : concat( out_grad, axis)
613
  composite : split_grad(out_grad, axis, x_grad)
Z
zyfncg 已提交
614

615
- backward_op : strided_slice_grad
Z
zyfncg 已提交
616 617 618 619 620 621 622 623 624 625
  forward : strided_slice (Tensor x, int[] axes, IntArray starts, IntArray ends, IntArray strides) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, int[] axes, IntArray starts, IntArray ends, IntArray strides)
  output : Tensor(x_grad)
  infer_meta :
    func : GeneralUnaryGradInferMeta
    param : [x]
  kernel :
    func : strided_slice_grad
  no_need_buffer : x

626
- backward_op : subtract_double_grad
Z
zyfncg 已提交
627 628 629 630 631 632 633 634 635 636 637
  forward : subtract_grad (Tensor x, Tensor y, Tensor grad_out, int axis = -1) -> Tensor(grad_x), Tensor(grad_y)
  args : (Tensor y, Tensor grad_out, Tensor grad_x_grad, Tensor grad_y_grad, int axis = -1)
  output : Tensor(grad_out_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [grad_out]
  kernel :
    func : subtract_double_grad
  optional : grad_x_grad, grad_y_grad
  no_need_buffer : y, grad_out
  inplace : (grad_x_grad -> grad_out_grad)
638
  composite : subtract_double_grad(y, grad_out, grad_x_grad, grad_y_grad, axis, grad_out_grad)
Z
zyfncg 已提交
639

640
- backward_op : subtract_grad
Z
zyfncg 已提交
641 642 643 644 645 646 647 648 649
  forward : subtract (Tensor x, Tensor y) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out_grad, int axis = -1)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : subtract_grad
  no_need_buffer : x, y
650
  composite : subtract_grad(x, y, out_grad, axis, x_grad, y_grad)
Z
zyfncg 已提交
651 652 653
  backward : subtract_double_grad
  inplace : (out_grad -> x_grad)

654
- backward_op : sum_double_grad
655 656
  forward : sum_grad (Tensor x, Tensor grad_out, IntArray axis, bool keepdim, bool reduce_all=false) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, IntArray axis={}, bool keepdim=false)
Z
zyfncg 已提交
657
  output : Tensor(grad_out_grad)
658
  invoke : sum(grad_x_grad, axis, grad_x_grad.dtype(), keepdim)
Z
zyfncg 已提交
659

660
- backward_op : sum_grad
661 662
  forward : sum (Tensor x, IntArray axis={}, DataType dtype=DataType::UNDEFINED, bool keepdim=false) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, IntArray axis, bool keepdim, bool reduce_all=false)
Z
zyfncg 已提交
663 664 665 666 667 668
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : sum_grad
669
  composite : sum_grad(x, out_grad, axis, keepdim, reduce_all, x_grad)
Z
zyfncg 已提交
670 671 672
  no_need_buffer : x
  backward : sum_double_grad

673
- backward_op : swish_grad
674
  forward : swish (Tensor x) -> Tensor(out)
675
  args : (Tensor x, Tensor out_grad)
Z
zyfncg 已提交
676 677 678 679 680 681 682 683
  output : Tensor(x_grad)
  infer_meta :
    func : GeneralUnaryGradInferMeta
    param : [x]
  kernel :
    func : swish_grad
  inplace : (out_grad -> x_grad)

684
- backward_op : sync_batch_norm_grad
685 686
  forward : sync_batch_norm_ (Tensor x, Tensor mean, Tensor variance, Tensor scale, Tensor bias, bool is_test, float momentum, float epsilon, str data_layout, bool use_global_stats, bool trainable_statistics) -> Tensor(out), Tensor(mean_out), Tensor(variance_out), Tensor(saved_mean), Tensor(saved_variance), Tensor(reserve_space)
  args : (Tensor x, Tensor scale, Tensor bias, Tensor saved_mean, Tensor saved_variance, Tensor reserve_space, Tensor out_grad, float momentum, float epsilon, str data_layout, bool is_test, bool use_global_stats, bool trainable_statistics)
687 688 689 690 691 692 693
  output : Tensor(x_grad), Tensor(scale_grad), Tensor(bias_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param : [x, scale, bias]
  kernel :
    func : sync_batch_norm_grad
    data_type : out_grad
694
  optional : reserve_space
695

696
- backward_op : tile_double_grad
Z
zyfncg 已提交
697 698 699
  forward : tile_grad (Tensor x, Tensor grad_out, IntArray repeat_times) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, IntArray repeat_times)
  output : Tensor(grad_out_grad)
700
  invoke : tile(grad_x_grad, repeat_times)
Z
zyfncg 已提交
701

702
- backward_op : tile_grad
Z
zyfncg 已提交
703 704 705 706 707 708 709 710 711
  forward : tile (Tensor x, IntArray repeat_times) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, IntArray repeat_times)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : tile_grad
  no_need_buffer : x
C
ccrrong 已提交
712
  composite : tile_grad(x, outgrad, repeat_times, x_grad)
Z
zyfncg 已提交
713 714
  backward : tile_double_grad

N
niuliling123 已提交
715 716 717 718 719 720 721 722 723
- backward_op : trans_layout_grad
  forward : trans_layout (Tensor x, int[] perm) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, int[] perm)
  output : Tensor(x_grad)
  infer_meta :
    func : TransLayoutGradInferMeta
  kernel :
    func : trans_layout_grad

724
- backward_op : transpose_double_grad
725 726
  forward : transpose_grad (Tensor grad_out, int[] perm) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, int[] perm)
Z
zyfncg 已提交
727
  output : Tensor(grad_out_grad)
728
  invoke : transpose(grad_x_grad, perm)
Z
zyfncg 已提交
729

730
- backward_op : transpose_grad
731 732
  forward : transpose (Tensor x, int[] perm) -> Tensor(out)
  args : (Tensor out_grad, int[] perm)
Z
zyfncg 已提交
733 734 735
  output : Tensor(x_grad)
  infer_meta :
    func : TransposeGradInferMeta
736
    param : [out_grad, perm]
Z
zyfncg 已提交
737 738 739
  kernel :
    func : transpose_grad
  backward : transpose_double_grad
740
  composite: transpose_grad(out_grad, perm, x_grad)
Z
zyfncg 已提交
741

742
- backward_op : tril_grad
743 744
  forward : tril(Tensor x,  int diagonal) -> Tensor(out)
  args : (Tensor out_grad,  int diagonal)
Z
zyfncg 已提交
745 746 747 748 749
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out_grad]
  kernel :
750
    func : tril_grad
Z
zyfncg 已提交
751

752 753 754 755 756 757 758 759 760
- backward_op : triu_grad
  forward : triu(Tensor x,  int diagonal) -> Tensor(out)
  args : (Tensor out_grad,  int diagonal)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out_grad]
  kernel :
    func : triu_grad
761 762 763 764 765 766 767 768 769 770 771

- backward_op: unpool_grad
  forward: unpool (Tensor x, Tensor indices, int[] ksize, int[] strides, int[] padding,  IntArray output_size, str data_format) -> Tensor(out)
  args: (Tensor x, Tensor indices, Tensor out, Tensor out_grad, int[] ksize, int[] strides, int[] padding, IntArray output_size, str data_format)
  output: Tensor(x_grad)
  infer_meta:
    func: UnchangedInferMeta
    param : [x]
  kernel:
    func: unpool_grad
    data_type: x