backward.yaml 80.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
#- backward_api : einsum_grad

  #forward : einsum (Tensor[] x, str equation) -> Tensor(out), Tensor[](inner_cache)
  #args : (Tensor[] x, Tensor[] inner_cache, Tensor out_grad, str equation)
  #output : Tensor[](x_grad){x.size()}
  #infer_meta :
    #func : UnchangedMultiInferMeta
    #param : [x]
  #kernel :
    #func : einsum_grad

12 13 14 15 16 17 18 19 20 21 22 23
- backward_api : abs_double_grad
  forward : abs_grad (Tensor x, Tensor grad_out) -> Tensor(grad_x)
  args : (Tensor x, Tensor grad_x_grad)
  output : Tensor(grad_out_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : abs_double_grad
  data_transform:
    skip_transform : grad_x_grad

24 25 26 27
- backward_api : abs_grad
  forward : abs (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
28
  infer_meta :
29
    func : UnchangedInferMeta
30
    param : [x]
31
  kernel :
32
    func : abs_grad
33 34
  data_transform:
    skip_transform : out_grad
35
  backward : abs_double_grad
36

37 38 39 40
- backward_api : acos_grad
  forward : acos (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
41
  infer_meta :
42 43
    func : UnchangedInferMeta
    param : [x]
44
  kernel :
45
    func : acos_grad
P
pangyoki 已提交
46
  inplace : (out_grad -> x_grad)
47

48 49 50
- backward_api : acosh_grad
  forward : acosh (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
51
  output : Tensor(x_grad)
52 53 54 55 56
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : acosh_grad
P
pangyoki 已提交
57
  inplace : (out_grad -> x_grad)
58

59 60 61 62 63 64 65 66 67 68 69
- backward_api : add_double_grad
  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
  backward : add_triple_grad
70
  inplace : (grad_x_grad -> grad_out_grad)
71

H
hong 已提交
72 73
- backward_api : add_grad
  forward : add (Tensor x, Tensor y) -> Tensor(out)
H
hong 已提交
74
  args : (Tensor x, Tensor y, Tensor out_grad, int axis = -1)
H
hong 已提交
75 76 77 78 79 80
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : add_grad
81
  no_need_buffer : x, y
82
  backward : add_double_grad
83
  inplace : (out_grad -> x_grad)
H
hong 已提交
84

85 86 87
- backward_api : add_n_grad
  forward : add_n (Tensor[] x) -> Tensor(out)
  args : (Tensor[] x, Tensor out_grad)
88
  output : Tensor[](x_grad){x.size()}
89
  invoke : add_n_grad_impl(x, out_grad, x_grad)
90 91
  no_need_buffer : x

92 93 94 95 96 97 98 99 100
- backward_api : 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
101
  inplace : (grad_grad_out_grad -> grad_grad_x_grad)
102

103
- backward_api : addmm_grad
H
hong 已提交
104
  forward : addmm (Tensor input, Tensor x, Tensor y, float alpha, float beta) -> Tensor(out)
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
  args : (Tensor input, Tensor x, Tensor y, Tensor out_grad, float alpha, float beta)
  output : Tensor(input_grad), Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param : [input, x, y]
  kernel :
    func : addmm_grad

- backward_api : argsort_grad
  forward : argsort (Tensor x, int axis, bool descending) -> Tensor(out), Tensor(indices)
  args : (Tensor indices, Tensor x, Tensor out_grad, int axis, bool descending)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : argsort_grad
H
hong 已提交
122
  no_need_buffer : x
123 124 125 126 127 128 129 130 131 132

- backward_api : asin_grad
  forward : asin (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : asin_grad
P
pangyoki 已提交
133
  inplace : (out_grad -> x_grad)
134 135 136 137 138 139 140 141 142 143

- backward_api : asinh_grad
  forward : asinh (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : asinh_grad
P
pangyoki 已提交
144
  inplace : (out_grad -> x_grad)
145

C
chentianyu03 已提交
146 147 148 149 150 151
- backward_api : assign_grad
  forward : assign (Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
Z
zyfncg 已提交
152 153
  kernel :
    func : assign
P
pangyoki 已提交
154
  inplace : (out_grad -> x_grad)
Z
zyfncg 已提交
155 156 157 158 159 160 161

- backward_api : assign_out__grad
  forward : assign_out_ (Tensor x, Tensor output) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
C
chentianyu03 已提交
162
  kernel :
163
    func : assign
P
pangyoki 已提交
164
  inplace : (out_grad -> x_grad)
C
chentianyu03 已提交
165

166
- backward_api : atan2_grad
167
  forward : atan2 (Tensor x, Tensor y) -> Tensor(out)
168
  args : (Tensor x, Tensor y, Tensor out_grad)
H
hong 已提交
169 170 171 172 173
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
174
    func : atan2_grad
H
hong 已提交
175

176 177 178 179 180 181 182 183 184
- backward_api : atan_grad
  forward : atan (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : atan_grad
P
pangyoki 已提交
185
  inplace : (out_grad -> x_grad)
186 187 188 189 190 191 192 193 194 195

- backward_api : atanh_grad
  forward : atanh (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : atanh_grad
P
pangyoki 已提交
196
  inplace : (out_grad -> x_grad)
197

198 199 200 201 202 203 204 205 206 207 208
- backward_api : batch_norm_double_grad
  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, bool fuse_with_relu) -> 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, bool fuse_with_relu)
  output : Tensor(x_grad), Tensor(scale_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param : [x, scale, x]
  kernel :
    func : batch_norm_grad_grad
    data_type : x
  optional : out_mean, out_variance
209
  inplace : (grad_out -> grad_out_grad)
210

H
hong 已提交
211 212 213 214 215 216 217 218 219 220 221
- backward_api : batch_norm_grad
  forward : batch_norm (Tensor x, Tensor scale, Tensor bias, Tensor mean, Tensor variance, float momentum, float epsilon, str data_layout, bool is_test, bool use_global_stats, bool trainable_statistics, bool fuse_with_relu) -> 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, bool fuse_with_relu)
  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
222
  backward : batch_norm_double_grad
H
hong 已提交
223

224 225 226 227 228 229 230 231 232
- backward_api : bce_loss_grad
  forward : bce_loss (Tensor input, Tensor label) -> Tensor(out)
  args : (Tensor input, Tensor label, Tensor out_grad)
  output : Tensor(input_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [input]
  kernel :
    func : bce_loss_grad
P
pangyoki 已提交
233
  inplace : (out_grad -> input_grad)
234 235 236 237 238 239 240 241 242 243

- backward_api : brelu_grad
  forward : brelu (Tensor x, float t_min, float t_max) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, float t_min, float t_max)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : brelu_grad
P
pangyoki 已提交
244
  inplace : (out_grad -> x_grad)
245 246 247 248 249 250 251 252 253 254 255

- backward_api : cast_grad
  forward : cast (Tensor x, DataType out_dtype) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : cast_grad
    data_type : out_grad
W
wanghuancoder 已提交
256
  no_need_buffer : x
257

258 259 260 261 262 263 264 265 266
- backward_api : ceil_grad
  forward : ceil(Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [out_grad]
  kernel :
    func : ceil_grad
P
pangyoki 已提交
267
  inplace : (out_grad -> x_grad)
268

269 270 271 272 273 274 275 276 277
- backward_api : celu_double_grad
  forward : celu_grad(Tensor x, Tensor grad_out, float alpha) -> Tensor(grad_x)
  args : (Tensor x, Tensor grad_out, Tensor grad_x_grad, float alpha)
  output : Tensor(x_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, x]
  kernel :
    func : celu_double_grad
278
  inplace : (grad_x_grad -> grad_out_grad)
279 280 281 282 283 284 285 286 287 288 289

- backward_api : celu_grad
  forward : celu(Tensor x, float alpha) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, float alpha)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : celu_grad
  backward : celu_double_grad
P
pangyoki 已提交
290
  inplace : (out_grad -> x_grad)
291

292 293 294 295 296 297 298 299 300 301 302
- backward_api : cholesky_grad
  forward : cholesky (Tensor x, bool upper) -> Tensor(out)
  args : (Tensor out, Tensor out_grad, bool upper)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : cholesky_grad

- backward_api : cholesky_solve_grad
303
  forward : cholesky_solve (Tensor x, Tensor y, bool upper) -> Tensor(out)
304
  args : (Tensor x, Tensor y, Tensor out, Tensor out_grad, bool upper)
H
hong 已提交
305 306 307 308 309
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
310 311
    func : cholesky_solve_grad

312 313 314 315 316 317 318 319 320 321
- backward_api : clip_double_grad
  forward : clip_grad (Tensor x, Tensor grad_out, Scalar min = 0., Scalar max = 0.) -> Tensor(grad_x)
  args : (Tensor x, Tensor grad_x_grad, Scalar min = 0., Scalar max = 0.)
  output : Tensor(grad_out_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : clip_grad

C
chentianyu03 已提交
322 323 324 325 326 327 328 329 330
- backward_api : clip_grad
  forward : clip (Tensor x, Scalar min, Scalar max) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, Scalar min = 0., Scalar max = 0.)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : clip_grad
331
  backward : clip_double_grad
P
pangyoki 已提交
332
  inplace : (out_grad -> x_grad)
333 334 335 336 337 338 339 340 341 342

- backward_api : concat_double_grad
  forward : concat_grad (Tensor[] x, Tensor grad_out, Scalar axis) -> Tensor[](grad_x)
  args : (Tensor[] grad_x_grad, Scalar axis = 0)
  output : Tensor(grad_out_grad)
  infer_meta :
    func : ConcatInferMeta
    param : [grad_x_grad, axis]
  kernel :
    func : concat
C
chentianyu03 已提交
343

344 345 346
- backward_api : concat_grad
  forward : concat (Tensor[] x, Scalar axis) -> Tensor(out)
  args : (Tensor[] x, Tensor out_grad, Scalar axis = 0)
347 348 349 350 351 352
  output : Tensor[](x_grad){x.size()}
  infer_meta :
    func : UnchangedMultiInferMeta
    param : [x]
  kernel :
    func : concat_grad
H
hong 已提交
353
  no_need_buffer : x
354
  backward : concat_double_grad
355

H
hong 已提交
356 357 358 359 360 361 362 363 364 365
- backward_api : conj_grad
  forward : conj (Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [out_grad]
  kernel :
    func : conj

H
hong 已提交
366 367 368 369
- backward_api : conv2d_grad
  forward : conv2d (Tensor input, Tensor filter, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search) -> Tensor(out)
  args : (Tensor input, Tensor filter, Tensor out_grad,  int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search)
  output : Tensor(input_grad), Tensor(filter_grad)
370
  invoke : conv2d_grad_impl(input, filter, out_grad,  strides, paddings, paddding_algorithm, groups, dilations, data_format, use_addto, workspace_size_MB, exhaustive_search, input_grad, filter_grad)
371 372 373 374 375 376 377 378 379 380 381
  backward : conv2d_grad_grad

- backward_api : conv2d_grad_grad
  forward : conv2d_grad (Tensor input, Tensor filter, Tensor grad_out,  int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search) -> Tensor(grad_input), Tensor(grad_filter)
  args : (Tensor input, Tensor filter, Tensor grad_out, Tensor grad_input_grad, Tensor grad_filter_grad, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search)
  output : Tensor(input_grad), Tensor(filter_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param: [input, filter, grad_out]
  kernel :
    func : conv2d_grad_grad
382
    use_gpudnn : true
383
  optional : grad_input_grad, grad_filter_grad
H
hong 已提交
384

C
chentianyu03 已提交
385 386 387 388 389 390 391 392 393 394
- backward_api : conv2d_transpose_double_grad
  forward : conv2d_transpose_grad(Tensor x, Tensor filter, Tensor grad_out, int[] strides, int[] paddings, int[] output_padding, int[] 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, int[] output_size, str padding_algorithm, int groups, int[] dilations, str data_format)
  output : Tensor(x_grad), Tensor(filter_grad), Tensor(grad_out_grad)
  infer_meta :
    func : Conv2dTransposeDoubleGradInferMeta
  kernel :
    func : conv2d_transpose_grad_grad
    use_gpudnn : true

F
From00 已提交
395 396 397 398 399 400
- backward_api : conv2d_transpose_grad
  forward : conv2d_transpose(Tensor x, Tensor filter, int[] strides, int[] paddings, int[] output_padding, int[] output_size, str padding_algorithm, int groups, int[] dilations, str data_format) -> Tensor(out)
  args : (Tensor x, Tensor filter, Tensor out_grad, int[] strides, int[] paddings, int[] output_padding, int[] output_size, str padding_algorithm, int groups, int[] dilations, str data_format)
  output : Tensor(x_grad), Tensor(filter_grad)
  infer_meta :
    func : ConvTransposeGradInferMeta
401
  kernel :
F
From00 已提交
402
    func : conv2d_transpose_grad
403
    use_gpudnn : true
C
chentianyu03 已提交
404
  backward : conv2d_transpose_double_grad
F
From00 已提交
405

406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
- backward_api : conv3d_grad
  forward : conv3d (Tensor input, Tensor filter, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search) -> Tensor(out)
  args : (Tensor input, Tensor filter, Tensor out_grad,  int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search)
  output : Tensor(input_grad), Tensor(filter_grad)
  invoke : conv3d_grad_impl(input, filter, out_grad,  strides, paddings, paddding_algorithm, groups, dilations, data_format, use_addto, workspace_size_MB, exhaustive_search, input_grad, filter_grad)
  backward : conv3d_grad_grad

- backward_api : conv3d_grad_grad
  forward : conv3d_grad (Tensor input, Tensor filter, Tensor grad_out,  int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search) -> Tensor(grad_input), Tensor(grad_filter)
  args : (Tensor input, Tensor filter, Tensor grad_out, Tensor grad_input_grad, Tensor grad_filter_grad, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search)
  output : Tensor(input_grad), Tensor(filter_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param: [input, filter, grad_out]
  kernel :
    func : conv3d_grad_grad
    use_gpudnn : true
  optional : grad_input_grad, grad_filter_grad

F
From00 已提交
425 426 427 428 429 430 431 432
- backward_api : conv3d_transpose_grad
  forward : conv3d_transpose(Tensor x, Tensor filter, int[] strides, int[] paddings, int[] output_padding, int[] output_size, str padding_algorithm, int groups, int[] dilations, str data_format) -> Tensor(out)
  args : (Tensor x, Tensor filter, Tensor out_grad, int[] strides, int[] paddings, int[] output_padding, int[] output_size, str padding_algorithm, int groups, int[] dilations, str data_format)
  output : Tensor(x_grad), Tensor(filter_grad)
  infer_meta :
    func : ConvTransposeGradInferMeta
  kernel :
    func : conv3d_transpose_grad
433
    use_gpudnn : true
F
From00 已提交
434

435 436 437 438 439 440 441 442 443
- backward_api : cos_grad
  forward : cos (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : cos_grad
P
pangyoki 已提交
444
  inplace : (out_grad -> x_grad)
445 446 447 448 449 450 451 452 453 454

- backward_api : cosh_grad
  forward : cosh (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : cosh_grad
P
pangyoki 已提交
455
  inplace : (out_grad -> x_grad)
456

457 458 459 460 461 462 463 464 465
- backward_api : cross_entropy_with_softmax_grad
  forward : cross_entropy_with_softmax (Tensor input, Tensor label, bool soft_label, bool use_softmax, bool numeric_stable_mode, int ignore_index, int axis) -> Tensor(softmax), Tensor(loss)
  args : (Tensor label, Tensor softmax, Tensor loss_grad, bool soft_label, bool use_softmax, bool numeric_stable_mode, int ignore_index, int axis)
  output : Tensor(input_grad)
  infer_meta :
    func : CrossEntropyWithSoftmaxGradInferMeta
  kernel :
    func : cross_entropy_with_softmax_grad
    data_type : softmax
466
  inplace : (softmax -> input_grad)
467

468 469 470 471 472 473 474 475 476 477
- backward_api : cross_grad
  forward : cross (Tensor x, Tensor y, int axis = 9) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out_grad, int axis)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : cross_grad

478 479 480 481 482 483 484 485 486 487
- backward_api : cumprod_grad
  forward : cumprod (Tensor x, int dim) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, int dim)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : cumprod_grad

488 489 490 491 492 493 494 495 496
- backward_api : cumsum_grad
  forward : cumsum(Tensor x, int axis, bool flatten, bool exclusive, bool reverse) -> Tensor(out)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  args : (Tensor out_grad, int axis, bool flatten, bool exclusive, bool reverse)
  output : Tensor(x_grad)
  invoke : cumsum(out_grad, axis, flatten, exclusive, !reverse)

497 498 499 500 501 502 503 504
- backward_api : deformable_conv_grad
  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
505
    data_type : x
506 507
  optional : mask

508
- backward_api : depthwise_conv2d_grad
509 510
  forward : depthwise_conv2d (Tensor input, Tensor filter, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search, bool fuse_relu, bool use_gpudnn) -> Tensor(out)
  args : (Tensor input, Tensor filter, Tensor out_grad, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search, bool fuse_relu, bool use_gpudnn)
511
  output : Tensor(input_grad), Tensor(filter_grad)
512 513 514 515 516 517 518
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [input, filter]
  kernel :
    func : depthwise_conv2d_grad
    param : [input, filter, out_grad, strides, paddings, paddding_algorithm, groups, dilations, data_format, use_addto, workspace_size_MB, exhaustive_search, fuse_relu]
    use_gpudnn : use_gpudnn
519 520 521
  backward : depthwise_conv2d_grad_grad

- backward_api : depthwise_conv2d_grad_grad
522 523
  forward : depthwise_conv2d_grad (Tensor input, Tensor filter, Tensor grad_out, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search, bool fuse_relu, bool use_gpudnn) -> Tensor(grad_input), Tensor(grad_filter)
  args : (Tensor input, Tensor filter, Tensor grad_out, Tensor grad_input_grad, Tensor grad_filter_grad, int[] strides, int[] paddings, str paddding_algorithm, int groups, int[] dilations, str data_format, bool use_addto, int workspace_size_MB, bool exhaustive_search, bool fuse_relu)
524 525 526 527 528
  output : Tensor(input_grad), Tensor(filter_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param: [input, filter, grad_out]
  kernel :
529
    func : depthwise_conv2d_grad_grad
530 531
  optional : grad_input_grad, grad_filter_grad

F
From00 已提交
532 533 534 535 536 537 538 539 540
- backward_api : depthwise_conv2d_transpose_grad
  forward : depthwise_conv2d_transpose(Tensor x, Tensor filter, int[] strides, int[] paddings, int[] output_padding, int[] output_size, str padding_algorithm, int groups, int[] dilations, str data_format) -> Tensor(out)
  args : (Tensor x, Tensor filter, Tensor out_grad, int[] strides, int[] paddings, int[] output_padding, int[] output_size, str padding_algorithm, int groups, int[] dilations, str data_format)
  output : Tensor(x_grad), Tensor(filter_grad)
  infer_meta :
    func : ConvTransposeGradInferMeta
  kernel :
    func : depthwise_conv2d_transpose_grad

C
chentianyu03 已提交
541 542 543 544 545 546 547 548
- backward_api : det_grad
  forward : det (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
549
    func : determinant_grad
C
chentianyu03 已提交
550

551 552 553 554 555 556 557 558 559
- backward_api : diagonal_grad
  forward : diagonal (Tensor x, int offset, int axis1, int axis2) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, int offset = 0, int axis1 = 0, int axis2 = 1)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : diagonal_grad
H
hong 已提交
560
  no_need_buffer : x
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580

- backward_api : digamma_grad
  forward : digamma (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : digamma_grad

- backward_api : dist_grad
  forward : dist (Tensor x, Tensor y, float p) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out, Tensor out_grad, float p)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : dist_grad
H
hong 已提交
581

582 583 584 585 586 587 588 589 590 591 592
- backward_api : divide_double_grad
  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
593
  inplace : (grad_x_grad -> grad_out_grad)
594

H
hong 已提交
595 596
- backward_api : divide_grad
  forward : divide (Tensor x, Tensor y) -> Tensor(out)
0
0x45f 已提交
597
  args : (Tensor x, Tensor y, Tensor out, Tensor out_grad, int axis = -1)
H
hong 已提交
598 599 600 601 602 603
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : divide_grad
604
  backward : divide_double_grad
H
hong 已提交
605

H
hong 已提交
606 607 608 609 610 611 612 613 614 615
- backward_api : dropout_grad
  forward : dropout (Tensor x, Tensor seed_tensor, float p, bool is_test, str mode, int seed, bool fix_seed) -> Tensor(out), Tensor(mask)
  args : (Tensor mask, Tensor out_grad, float p, bool is_test, str mode)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out_grad]
  kernel :
    func : dropout_grad

616 617 618 619 620 621 622 623 624
- backward_api : eigh_grad
  forward : eigh (Tensor x, str uplo) -> Tensor(out_w), Tensor(out_v)
  args : (Tensor out_w, Tensor out_v, Tensor out_w_grad, Tensor out_v_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out_v]
  kernel :
    func : eigh_grad
625 626 627
    data_type : out_v
  data_transform:
    skip_transform : out_w, out_w_grad
H
hong 已提交
628

629
- backward_api : einsum_grad
630 631
  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)
632 633 634
  output : Tensor[](x_grad){x.size()}
  infer_meta :
    func : UnchangedMultiInferMeta
635
    param : [x_shape]
636 637 638
  kernel :
    func : einsum_grad

639 640 641 642 643 644 645 646 647 648
- backward_api : elementwise_pow_grad
  forward : elementwise_pow(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 : elementwise_pow_grad

649 650 651 652 653 654 655 656 657
- backward_api : elu_double_grad
  forward : elu_grad (Tensor x, Tensor out, Tensor grad_out, float alpha)-> Tensor(grad_x)
  args : (Tensor x, Tensor grad_out, Tensor grad_x_grad, float alpha)
  output : Tensor(x_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, x]
  kernel :
    func : elu_double_grad
658
  inplace : (grad_x_grad -> grad_out_grad)
659

660 661 662 663 664 665 666 667 668
- backward_api : elu_grad
  forward : elu (Tensor x, float alpha) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, float alpha)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : elu_grad
669
  backward : elu_double_grad
P
pangyoki 已提交
670
  inplace : (out_grad -> x_grad)
671

Z
zyfncg 已提交
672 673 674 675 676 677
- backward_api : embedding_grad
  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)

678 679 680 681 682 683 684 685 686 687 688 689
- backward_api : erf_grad
  forward : erf (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : erf_grad
    data_type : out_grad

- backward_api : erfinv_grad
690
  forward : erfinv (Tensor x) -> Tensor(out)
691 692 693 694 695 696 697 698
  args : (Tensor out, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : erfinv_grad

C
chentianyu03 已提交
699 700 701 702 703 704 705 706 707
- backward_api : exp_grad
  forward : exp (Tensor x) -> Tensor(out)
  args : (Tensor out, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : exp_grad
P
pangyoki 已提交
708
  inplace : (out_grad -> x_grad)
C
chentianyu03 已提交
709

H
hong 已提交
710 711 712 713 714 715 716 717 718
- backward_api : expand_as_grad
  forward : expand_as (Tensor x, Tensor y, int[] target_shape) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, int[] target_shape)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : expand_as_grad
H
hong 已提交
719
  no_need_buffer : x
720

721 722 723 724 725 726 727 728 729
- backward_api : expand_double_grad
  forward : expand_grad (Tensor x, Tensor grad_out, IntArray shape) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, IntArray shape)
  output : Tensor(grad_out_grad)
  infer_meta :
    func : ExpandInferMeta
  kernel :
    func : expand

H
hong 已提交
730 731 732 733 734 735 736 737 738
- backward_api : expand_grad
  forward : expand (Tensor x, IntArray shape) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, IntArray shape)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : expand_grad
W
wanghuancoder 已提交
739
  no_need_buffer : x
740
  backward : expand_double_grad
H
hong 已提交
741

742 743 744 745 746 747 748 749 750
- backward_api : expm1_grad
  forward : expm1 (Tensor x) -> Tensor(out)
  args : (Tensor out, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : expm1_grad
P
pangyoki 已提交
751
  inplace : (out_grad -> x_grad)
752

753 754 755 756 757 758 759 760 761 762 763 764
- backward_api : flatten_grad
  forward : flatten(Tensor x, int start_axis, int stop_axis) -> Tensor(out), Tensor(xshape)
  args : (Tensor xshape, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func :  KernelWithXShapeInferMeta
    param : [xshape]
  kernel :
    func : flatten_grad
    data_type: out_grad
    backend: out_grad
    layout: out_grad
765
  inplace : (out_grad -> x_grad)
766

H
hong 已提交
767 768 769 770 771 772 773 774 775 776
- backward_api : flip_grad
  forward : flip (Tensor x, int[] axis) -> Tensor(out)
  args : (Tensor out_grad, int[] axis)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [out_grad]
  kernel :
    func : flip

777 778 779 780 781 782 783 784 785
- backward_api : floor_grad
  forward : floor(Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [out_grad]
  kernel :
    func : floor_grad
P
pangyoki 已提交
786
  inplace : (out_grad -> x_grad)
787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807

- backward_api : fmax_grad
  forward : fmax(Tensor x, Tensor y, int axis) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out_grad, int axis)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param: [x, y]
  kernel :
    func : fmax_grad

- backward_api : fmin_grad
  forward : fmin(Tensor x, Tensor y, int axis) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out_grad, int axis)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param: [x, y]
  kernel :
    func : fmin_grad

F
From00 已提交
808 809 810 811 812 813 814 815 816 817
- backward_api : frobenius_norm_grad
  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

818 819 820 821 822 823 824 825 826 827
- backward_api : gather_grad
  forward : gather(Tensor x, Tensor index, Scalar axis=0) -> Tensor(out)
  args : (Tensor x, Tensor index, Tensor out_grad, Scalar axis=0, bool overwrite=false)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    data_type: x
    func : gather_grad
H
hong 已提交
828
  no_need_buffer : x
829

830 831 832 833 834 835 836 837 838
- backward_api : gather_nd_grad
  forward : gather_nd (Tensor x, Tensor index) -> Tensor(out)
  args : (Tensor x, Tensor index, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : gather_nd_grad
H
hong 已提交
839
  no_need_buffer : x
840

841 842 843 844 845 846 847 848 849 850
- backward_api : gelu_grad
  forward : gelu(Tensor x,  bool approximate) -> Tensor(out)
  args : (Tensor x, Tensor out_grad,  bool approximate)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : gelu_grad

851 852 853 854 855 856 857 858 859
- backward_api : graph_send_recv_grad
  forward : graph_send_recv (Tensor x, Tensor src_index, Tensor dst_index, str pool_type = "SUM", int64_t out_size = 0) -> Tensor(out), Tensor(dst_count)
  args : (Tensor x, Tensor src_index, Tensor dst_index, Tensor out, Tensor dst_count, Tensor out_grad, str pool_type = "SUM")
  output : Tensor(x_grad)
  infer_meta :
    func : GeneralUnaryGradInferMeta
    param : [x]
  kernel :
    func : graph_send_recv_grad
860
    data_type : out_grad
861 862
  optional: out, dst_count

863 864 865 866 867 868 869 870 871 872 873 874 875
- backward_api : group_norm_grad
  forward : group_norm (Tensor x, Tensor scale, Tensor bias, float epsilon, int groups, str data_layout) -> Tensor(y), Tensor(mean), Tensor(variance)
  args : (Tensor x, Tensor scale, Tensor bias, Tensor y, Tensor mean, Tensor variance, Tensor y_grad, float epsilon, int groups, str data_layout)
  output : Tensor(x_grad), Tensor(scale_grad), Tensor(bias_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param : [y, scale, bias]
  kernel :
    func : group_norm_grad
    data_type : y_grad
  optional: scale, bias
  inplace : (y_grad -> x_grad)

H
hong 已提交
876 877 878 879 880 881 882 883 884 885
- backward_api : gumbel_softmax_grad
  forward : gumbel_softmax (Tensor x, float temperature, bool hard, int axis) -> Tensor(out)
  args : (Tensor out, Tensor out_grad, int axis)
  output : Tensor(x_grad)
  infer_meta :
    func : GumbelSoftmaxGradInferMeta
    param : [out, out_grad, axis]
  kernel :
    func : gumbel_softmax_grad

886 887 888 889 890 891 892 893 894
- backward_api : hard_shrink_grad
  forward : hard_shrink (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 : hard_shrink_grad
P
pangyoki 已提交
895
  inplace : (out_grad -> x_grad)
896 897 898 899 900 901 902 903 904 905

- backward_api : hard_sigmoid_grad
  forward : hard_sigmoid (Tensor x, float slope, float offset) -> Tensor(out)
  args : (Tensor out, Tensor out_grad, float slope, float offset)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : hard_sigmoid_grad
P
pangyoki 已提交
906
  inplace : (out_grad -> x_grad)
907

908 909 910 911 912 913 914 915 916
- backward_api : hard_swish_grad
  forward : hard_swish (Tensor x, float threshold = 6.0, float scale = 6.0, float offset = 3.0) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, float threshold, float scale, float offset)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : hard_swish_grad
P
pangyoki 已提交
917
  inplace : (out_grad -> x_grad)
918

919 920 921 922 923 924 925 926 927 928
- backward_api : huber_loss_grad
  forward : huber_loss (Tensor input, Tensor label, float delta) -> Tensor(out), Tensor(residual)
  args : (Tensor residual, Tensor out_grad, float delta)
  output : Tensor(input_grad), Tensor(label_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [residual, residual]
  kernel :
    func : huber_loss_grad

Z
zyfncg 已提交
929 930 931 932
- backward_api : imag_grad
  forward : imag (Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
933
  invoke : imag_grad_impl(out_grad, x_grad)
Z
zyfncg 已提交
934

935 936 937 938 939 940 941 942 943 944
- backward_api : index_sample_grad
  forward : index_sample (Tensor x, Tensor index) -> Tensor(out)
  args : (Tensor x, Tensor index, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : index_sample_grad
    data_type : out_grad
H
hong 已提交
945
  no_need_buffer : x
946

F
From00 已提交
947 948 949 950 951 952 953 954 955 956
- backward_api : index_select_grad
  forward : index_select(Tensor x, Tensor index,  int dim) -> Tensor(out)
  args : (Tensor x, Tensor index, Tensor out_grad,  int dim)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : index_select_grad
    data_type : x
H
hong 已提交
957
  no_need_buffer : x
F
From00 已提交
958

959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981
- backward_api : instance_norm_double_grad
  forward : instance_norm_grad(Tensor x, Tensor fwd_scale, Tensor saved_mean, Tensor saved_variance, Tensor grad_y, float epsilon) -> Tensor(grad_x), Tensor(grad_scale), Tensor(grad_bias)
  args : (Tensor x, Tensor fwd_scale, Tensor saved_mean, Tensor saved_variance, Tensor grad_y, Tensor grad_x_grad, Tensor grad_scale_grad, Tensor grad_bias_grad, float epsilon)
  output : Tensor(x_grad), Tensor(fwd_scale_grad), Tensor(grad_y_grad)
  infer_meta :
    func : InstanceNormDoubleGradInferMeta
  kernel :
    func : instance_norm_double_grad
    data_type : x
  optional : fwd_scale, grad_x_grad, grad_scale_grad, grad_bias_grad

- backward_api : instance_norm_grad
  forward : instance_norm(Tensor x, Tensor scale, Tensor bias, float epsilon) -> Tensor(y), Tensor(saved_mean), Tensor(saved_variance)
  args : (Tensor x, Tensor scale, Tensor saved_mean, Tensor saved_variance, Tensor y_grad, float epsilon)
  output : Tensor(x_grad), Tensor(scale_grad), Tensor(bias_grad)
  infer_meta :
    func : InstanceNormGradInferMeta
  kernel :
    func : instance_norm_grad
    data_type : x
  optional : scale
  backward : instance_norm_double_grad

982 983 984 985 986 987 988 989 990
- backward_api : kldiv_loss_grad
  forward : kldiv_loss(Tensor x, Tensor label, str reduction) -> Tensor(out)
  args : (Tensor x, Tensor label, Tensor out_grad, str reduction)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : kldiv_loss_grad
H
hong 已提交
991
  no_need_buffer : x
992

993 994 995 996 997 998 999 1000 1001 1002 1003
- backward_api : kron_grad
  forward : kron (Tensor x, Tensor y) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out_grad)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : kron_grad
    data_type : out_grad

1004 1005 1006 1007 1008 1009 1010 1011 1012 1013
- backward_api : kthvalue_grad
  forward : kthvalue(Tensor x, int k, int axis, bool keepdim) -> Tensor(out), Tensor(indices)
  args : (Tensor x, Tensor indices, Tensor out_grad, int k, int axis, bool keepdim)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : kthvalue_grad

1014 1015 1016 1017 1018 1019 1020 1021 1022 1023
- backward_api : label_smooth_grad
  forward : label_smooth (Tensor label, Tensor prior_dist, float epsilon) -> Tensor(out)
  args : (Tensor out_grad, float epsilon)
  output : Tensor(label_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out_grad]
  kernel :
    func : label_smooth_grad

H
hong 已提交
1024 1025 1026 1027 1028 1029 1030 1031 1032 1033
- backward_api : layer_norm_grad
  forward : layer_norm (Tensor x, Tensor scale, Tensor bias, float epsilon, int begin_norm_axis, bool is_test) -> Tensor(out), Tensor(mean), Tensor(variance)
  args : (Tensor x,  Tensor scale, Tensor bias, Tensor mean, Tensor variance, Tensor out_grad, float epsilon, int begin_norm_axis, bool is_test)
  output : Tensor(x_grad), Tensor(scale_grad), Tensor(bias_grad)
  infer_meta :
    func : LayerNormGradInferMeta
    param : [x, scale, bias]
  kernel :
    func : layer_norm_grad
    data_type : out_grad
W
wanghuancoder 已提交
1034
  no_need_buffer : bias
H
hong 已提交
1035 1036
  optional : scale, bias

1037 1038 1039 1040 1041 1042 1043 1044 1045
- backward_api : leaky_relu_double_grad
  forward : leaky_relu_grad (Tensor x, Tensor grad_out, float alpha) -> Tensor(grad_x)
  args : (Tensor x, Tensor grad_x_grad, float alpha)
  output : Tensor(grad_out_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [grad_x_grad]
  kernel :
    func : leaky_relu_double_grad
1046
  inplace : (grad_x_grad -> grad_out_grad)
1047

1048 1049 1050 1051 1052 1053 1054 1055 1056
- backward_api : leaky_relu_grad
  forward : leaky_relu (Tensor x, float alpha) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, float alpha)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : leaky_relu_grad
1057
  backward : leaky_relu_double_grad
P
pangyoki 已提交
1058
  inplace : (out_grad -> x_grad)
1059 1060

- backward_api : lerp_grad
1061
  forward : lerp (Tensor x, Tensor y, Tensor weight) -> Tensor(out)
1062 1063 1064 1065 1066 1067 1068 1069
  args : (Tensor x, Tensor y, Tensor weight, Tensor out, Tensor out_grad)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : lerp_grad

1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088
- backward_api : lgamma_grad
  forward : lgamma(Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : lgamma_grad

- backward_api : log10_grad
  forward : log10 (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : log10_grad
P
pangyoki 已提交
1089
  inplace : (out_grad -> x_grad)
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099

- backward_api : log1p_grad
  forward : log1p (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : log1p_grad
P
pangyoki 已提交
1100
  inplace : (out_grad -> x_grad)
1101 1102 1103 1104 1105 1106 1107 1108 1109 1110

- backward_api : log2_grad
  forward : log2 (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : log2_grad
P
pangyoki 已提交
1111
  inplace : (out_grad -> x_grad)
1112

1113 1114 1115 1116 1117 1118 1119 1120 1121
- backward_api : log_double_grad
  forward : log_grad (Tensor x, Tensor grad_out) -> Tensor(grad_x)
  args : (Tensor x, Tensor grad_out, Tensor grad_x_grad)
  output : Tensor(x_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, x]
  kernel :
    func : log_double_grad
1122
  inplace : (grad_x_grad -> grad_out_grad)
1123

1124 1125 1126 1127 1128 1129 1130 1131 1132
- backward_api : log_grad
  forward : log (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : log_grad
1133
  backward : log_double_grad
P
pangyoki 已提交
1134
  inplace : (out_grad -> x_grad)
1135

1136 1137 1138 1139 1140 1141 1142 1143 1144 1145
- backward_api : log_loss_grad
  forward : log_loss (Tensor input, Tensor label, float epsilon) -> Tensor(out)
  args : (Tensor input, Tensor label, Tensor out_grad, float epsilon)
  output : Tensor(input_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [input]
  kernel :
    func : log_loss_grad

1146 1147 1148 1149 1150 1151 1152 1153 1154 1155
- backward_api : log_softmax_grad
  forward : log_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 : log_softmax_grad

1156 1157 1158 1159 1160 1161 1162 1163 1164 1165
- backward_api : logcumsumexp_grad
  forward : logcumsumexp(Tensor x, int axis, bool flatten, bool exclusive, bool reverse) -> Tensor(out)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  args : (Tensor x, Tensor out, Tensor out_grad, int axis, bool flatten, bool exclusive, bool reverse)
  output : Tensor(x_grad)
  kernel :
    func : logcumsumexp_grad

1166 1167 1168 1169 1170 1171 1172 1173 1174 1175
- backward_api : logit_grad
  forward : logit (Tensor x, float eps = 1e-6f) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, float eps)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : logit_grad

1176 1177
- backward_api : logsigmoid_grad
  forward : logsigmoid (Tensor x) -> Tensor(out)
H
hong 已提交
1178 1179 1180
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
1181 1182 1183 1184
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : logsigmoid_grad
P
pangyoki 已提交
1185
  inplace : (out_grad -> x_grad)
1186

1187 1188 1189 1190 1191 1192 1193 1194 1195 1196
- backward_api : logsumexp_grad
  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

1197 1198 1199 1200 1201 1202 1203 1204 1205 1206
- backward_api : masked_select_grad
  forward : masked_select (Tensor x, Tensor mask) -> Tensor(out)
  args : (Tensor x, Tensor mask, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : masked_select_grad
    data_type : x
H
hong 已提交
1207
  no_need_buffer : x
1208 1209

- backward_api : matmul_double_grad
1210 1211 1212
  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)
1213 1214
  infer_meta :
    func : GeneralTernaryGradInferMeta
1215
    param : [x, y, grad_out]
1216 1217
  kernel :
    func : matmul_double_grad
1218
  backward : matmul_triple_grad
1219
  optional : grad_x_grad, grad_y_grad
1220 1221 1222 1223 1224 1225 1226 1227 1228 1229

- backward_api : matmul_grad
  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
1230
  backward : matmul_double_grad
1231

1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242
- backward_api : matmul_triple_grad
  forward : matmul_double_grad (Tensor x, Tensor y, Tensor fwd_grad_out, Tensor fwd_grad_grad_x, Tensor fwd_grad_grad_y, bool transpose_x=false, bool transpose_y=false) -> 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, bool transpose_x=false, bool transpose_y=false)
  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 : matmul_triple_grad
  optional : grad_x_grad, grad_y_grad, grad_grad_out_grad

1243 1244 1245 1246 1247 1248 1249 1250 1251 1252
- backward_api : matrix_power_grad
  forward : matrix_power (Tensor x, int n) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, int n)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : matrix_power_grad

1253 1254 1255 1256 1257 1258 1259 1260 1261 1262
- backward_api : max_grad
  forward: max (Tensor x,  int64_t[] dims={},  bool keep_dim=false) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, int64_t[] dims={},  bool keep_dim=false, bool reduce_all=false)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : max_grad

F
From00 已提交
1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280
- backward_api : max_pool2d_with_index_grad
  forward : max_pool2d_with_index(Tensor x, int[] kernel_size, int[] strides, int[] paddings, bool global_pooling, bool adaptive) -> Tensor(out), Tensor(mask)
  args : (Tensor x, Tensor mask, Tensor out_grad, int[] kernel_size, int[] strides, int[] paddings, bool global_pooling, bool adaptive)
  output : Tensor(x_grad)
  infer_meta :
    func : MaxPoolWithIndexGradInferMeta
  kernel :
    func : max_pool2d_with_index_grad

- backward_api : max_pool3d_with_index_grad
  forward : max_pool3d_with_index(Tensor x, int[] kernel_size, int[] strides, int[] paddings, bool global_pooling, bool adaptive) -> Tensor(out), Tensor(mask)
  args : (Tensor x, Tensor mask, Tensor out_grad, int[] kernel_size, int[] strides, int[] paddings, bool global_pooling, bool adaptive)
  output : Tensor(x_grad)
  infer_meta :
    func : MaxPoolWithIndexGradInferMeta
  kernel :
    func : max_pool3d_with_index_grad

1281 1282 1283 1284 1285 1286 1287 1288 1289 1290
- backward_api : maximum_grad
  forward : maximum(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 : maximum_grad

1291 1292 1293 1294 1295 1296 1297 1298 1299 1300
- backward_api : maxout_grad
  forward : maxout(Tensor x, int groups, int axis) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, int groups, int axis)
  output : Tensor(x_grad)
  infer_meta :
    func : GeneralUnaryGradInferMeta
    param: [x]
  kernel :
    func : maxout_grad

1301 1302 1303 1304 1305 1306 1307 1308 1309 1310
- backward_api : mean_all_grad
  forward : mean_all(Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : mean_all_grad

1311 1312 1313 1314 1315 1316
- backward_api : mean_double_grad
  forward: mean_grad (Tensor x, Tensor grad_out, int64_t[] dims={},  bool keep_dim=false, bool reduce_all = false) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, int64_t[] dims={},  bool keep_dim=false, bool reduce_all=false)
  output : Tensor(grad_out_grad)
  invoke : mean(grad_x_grad, dims, keep_dim)

1317 1318 1319 1320 1321 1322 1323 1324 1325
- backward_api : mean_grad
  forward: mean (Tensor x,  int64_t[] dims={},  bool keep_dim=false) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, int64_t[] dims={},  bool keep_dim=false, bool reduce_all=false)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : mean_grad
1326
  backward : mean_double_grad
H
hong 已提交
1327
  no_need_buffer : x
1328

Y
YuanRisheng 已提交
1329 1330 1331
- backward_api : meshgrid_grad
  forward : meshgrid (Tensor[] inputs) -> Tensor[](outputs)
  args : (Tensor[] inputs, Tensor[] outputs_grad)
1332 1333 1334 1335 1336
  output : Tensor[](inputs_grad){inputs.size()}
  infer_meta :
    func : MeshgridGradInferMeta
  kernel :
    func : meshgrid_grad
Y
YuanRisheng 已提交
1337

1338 1339 1340 1341 1342 1343 1344 1345 1346 1347
- backward_api : min_grad
  forward: min (Tensor x,  int64_t[] dims={},  bool keep_dim=false) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, int64_t[] dims={},  bool keep_dim=false, bool reduce_all=false)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : min_grad

1348 1349 1350 1351 1352 1353 1354 1355 1356 1357
- backward_api : minimum_grad
  forward : minimum(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 : minimum_grad

1358 1359 1360 1361 1362 1363 1364 1365 1366
- backward_api : mish_grad
  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
P
pangyoki 已提交
1367
  inplace : (out_grad -> x_grad)
1368

1369 1370 1371 1372 1373 1374 1375 1376 1377 1378
- backward_api : mode_grad
  forward : mode(Tensor x,  int axis,  bool keepdim) -> Tensor(out), Tensor(indices)
  args : (Tensor x, Tensor indices, Tensor out_grad,  int axis,  bool keepdim)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : mode_grad

1379
- backward_api : modulo_grad
1380
  forward : modulo (Tensor x, Tensor y) -> Tensor(out)
1381 1382 1383 1384 1385 1386 1387 1388 1389
  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 : modulo_grad
  no_need_buffer : x, y

1390 1391 1392
- backward_api : multi_dot_grad
  forward : multi_dot (Tensor[] x) -> Tensor(out)
  args : (Tensor[] x, Tensor out_grad)
1393 1394 1395 1396 1397
  output : Tensor[](x_grad) {x.size()}
  infer_meta :
    func : MultiDotGradInferMeta
  kernel :
    func : multi_dot_grad
1398 1399 1400 1401

- backward_api : multiplex_grad
  forward : multiplex (Tensor[] ins, Tensor ids) -> Tensor(out)
  args : (Tensor[] ins, Tensor ids, Tensor out_grad)
1402 1403 1404 1405 1406 1407 1408
  output : Tensor[](ins_grad){ins.size()}
  infer_meta :
    func : MultiplexGradInferMeta
    param : [ids, out_grad]
  kernel :
    func : multiplex_grad
    param : [ids, out_grad]
1409

1410 1411 1412 1413 1414 1415 1416 1417 1418 1419
- backward_api : multiply_double_grad
  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
1420
  backward : multiply_triple_grad
1421
  inplace : (grad_x_grad -> grad_out_grad)
1422

1423 1424 1425 1426 1427 1428 1429 1430 1431
- backward_api : multiply_grad
  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
1432
  backward : multiply_double_grad
1433

1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444
- backward_api : 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, x, y]
  kernel :
    func : multiply_triple_grad
  optional : fwd_grad_grad_x, fwd_grad_grad_y, grad_grad_out_grad

1445 1446 1447 1448 1449 1450 1451
- backward_api : mv_grad
  forward : mv (Tensor x, Tensor vec) -> Tensor(out)
  args : (Tensor x, Tensor vec, Tensor out_grad)
  output : Tensor(x_grad), Tensor(vec_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, vec]
H
hong 已提交
1452
  kernel :
1453
    func : mv_grad
H
hong 已提交
1454

1455
- backward_api : nll_loss_grad
Z
zyfncg 已提交
1456 1457 1458
  forward : nll_loss (Tensor input, Tensor label, Tensor weight, int64_t ignore_index, str reduction) -> Tensor(out), Tensor(total_weight)
  args : (Tensor input, Tensor label, Tensor weight, Tensor total_weight, Tensor out_grad, int64_t ignore_index, str reduction)
  output : Tensor(input_grad)
H
hong 已提交
1459
  infer_meta :
Z
zyfncg 已提交
1460
    func : NllLossGradInferMeta
H
hong 已提交
1461
  kernel :
1462
    func : nll_loss_grad
Z
zyfncg 已提交
1463
    data_type : input
1464
  optional : weight
H
hong 已提交
1465

H
hong 已提交
1466 1467 1468 1469 1470 1471 1472 1473 1474 1475
- backward_api : norm_grad
  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

1476 1477 1478 1479 1480 1481 1482 1483 1484 1485
- backward_api : p_norm_grad
  forward : p_norm(Tensor x,  float porder,  int axis,  float epsilon,  bool keepdim,  bool asvector=false) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad,  float porder,  int axis,  float epsilon,  bool keepdim,  bool asvector)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : p_norm_grad

1486 1487 1488 1489 1490 1491 1492 1493 1494
- backward_api : pad3d_double_grad
  forward : pad3d_grad(Tensor x, Tensor grad_out, IntArray paddings, str mode, float pad_value, str data_format) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, IntArray paddings, str mode, float pad_value, str data_format)
  output : Tensor(grad_out_grad)
  infer_meta :
    func : Pad3dInferMeta
  kernel :
    func : pad3d

1495 1496 1497 1498 1499 1500 1501 1502 1503
- backward_api : pad3d_grad
  forward : pad3d(Tensor x, IntArray paddings, str mode,  float pad_value, str data_format) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, IntArray paddings, str mode,  float pad_value, str data_format)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : pad3d_grad
W
wanghuancoder 已提交
1504
  no_need_buffer : x
1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527
  backward : pad3d_double_grad

- backward_api : pad_double_grad
  forward : pad_grad(Tensor x, Tensor grad_out, int[] paddings, float pad_value) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, int[] paddings, float pad_value)
  output : Tensor(grad_out_grad)
  infer_meta :
    func : PadInferMeta
  kernel :
    func : pad

- backward_api : pad_grad
  forward : pad(Tensor x, int[] paddings, float pad_value) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, int[] paddings, float pad_value)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : pad_grad
    param: [out_grad, paddings, pad_value]
  no_need_buffer : x
  backward : pad_double_grad
1528

H
hong 已提交
1529 1530 1531 1532 1533 1534 1535 1536 1537
- backward_api : pixel_shuffle_grad
  forward : pixel_shuffle (Tensor x, int upscale_factor, str data_format) -> Tensor(out)
  args : (Tensor out_grad, int upscale_factor, str data_format)
  output : Tensor(x_grad)
  infer_meta :
    func : PixelShuffleGradInferMeta
  kernel :
    func : pixel_shuffle_grad

H
hong 已提交
1538 1539 1540 1541 1542 1543 1544 1545 1546 1547
- backward_api : poisson_grad
  forward : poisson (Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out_grad]
  kernel :
    func : poisson_grad

1548 1549 1550 1551 1552 1553 1554 1555 1556 1557
- backward_api : pool2d_double_grad
  forward : pool2d_grad(Tensor x, Tensor out, Tensor grad_out, 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(grad_x)
  args : (Tensor grad_x_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)
  output : Tensor(grad_out_grad)
  infer_meta :
    func : PoolInferMeta
  kernel :
    func : pool2d_double_grad
    use_gpudnn : true

F
From00 已提交
1558 1559 1560 1561 1562 1563 1564 1565
- backward_api : pool2d_grad
  forward : pool2d(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)
  output : Tensor(x_grad)
  infer_meta :
    func : PoolGradInferMeta
  kernel :
    func : pool2d_grad
1566
    use_gpudnn : true
1567
  backward : pool2d_double_grad
1568 1569 1570 1571 1572 1573 1574 1575 1576 1577

- backward_api : pool2d_grad_gpudnn_unused
  forward : pool2d_gpudnn_unused(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)
  output : Tensor(x_grad)
  infer_meta :
    func : PoolGradInferMeta
  kernel :
    func : pool2d_grad
    use_gpudnn : false
F
From00 已提交
1578 1579 1580 1581 1582 1583 1584 1585 1586

- backward_api : pool3d_grad
  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)
  output : Tensor(x_grad)
  infer_meta :
    func : PoolGradInferMeta
  kernel :
    func : pool3d_grad
1587
    use_gpudnn : true
F
From00 已提交
1588

1589 1590 1591 1592 1593 1594 1595 1596 1597
- backward_api : pow_grad
  forward : pow(Tensor x, Scalar s) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, Scalar s=-1)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : pow_grad
P
pangyoki 已提交
1598
  inplace : (out_grad -> x_grad)
1599

1600 1601 1602 1603 1604 1605 1606 1607 1608 1609
- backward_api : prelu_grad
  forward : prelu(Tensor x, Tensor alpha, str data_format, str mode) -> Tensor(out)
  args : (Tensor x, Tensor alpha, Tensor out_grad, str data_format, str mode)
  output : Tensor(x_grad), Tensor(alpha_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param: [x, alpha]
  kernel :
    func : prelu_grad

1610
- backward_api : psroi_pool_grad
Z
zyfncg 已提交
1611 1612
  forward : psroi_pool (Tensor x, Tensor boxes, Tensor boxes_num, int pooled_height, int pooled_width, int output_channels, float spatial_scale) -> Tensor(out)
  args : (Tensor x, Tensor boxes, Tensor boxes_num, Tensor out_grad, int pooled_height, int pooled_width, int output_channels, float spatial_scale)
1613 1614
  output : Tensor(x_grad)
  infer_meta :
Z
zyfncg 已提交
1615
    func : GeneralUnaryGradInferMeta
1616 1617
    param : [x]
  kernel :
1618
    func : psroi_pool_grad
1619
    data_type : x
Z
zyfncg 已提交
1620
  optional : boxes_num
1621 1622 1623 1624 1625 1626

# output is optional
- backward_api : put_along_axis_grad
  forward : put_along_axis (Tensor x, Tensor index, Tensor value, int axis, str reduce) -> Tensor(out)
  args : (Tensor x, Tensor index, Tensor out_grad, int axis, str reduce)
  output : Tensor(x_grad), Tensor(value_grad)
H
hong 已提交
1627
  infer_meta :
1628 1629
    func : GeneralBinaryGradInferMeta
    param : [x, index]
H
hong 已提交
1630
  kernel :
1631
    func : put_along_axis_grad
H
hong 已提交
1632

Z
zyfncg 已提交
1633 1634 1635 1636
- backward_api : real_grad
  forward : real (Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
1637
  invoke : real_grad_impl(out_grad, x_grad)
Z
zyfncg 已提交
1638

1639 1640 1641 1642 1643 1644 1645 1646 1647
- backward_api : reciprocal_grad
  forward : reciprocal (Tensor x) -> Tensor(out)
  args : (Tensor out, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : reciprocal_grad
P
pangyoki 已提交
1648
  inplace : (out_grad -> x_grad)
1649

H
hong 已提交
1650 1651 1652 1653 1654 1655 1656 1657
- backward_api : reduce_prod_grad
  forward : reduce_prod (Tensor x, int64_t[] dims, bool keep_dim, bool reduce_all) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad, int64_t[] dims,  bool keep_dim, bool reduce_all)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
H
hong 已提交
1658
    func : prod_grad
H
hong 已提交
1659

1660 1661 1662
- backward_api : relu_double_grad
  forward : relu_grad (Tensor out, Tensor grad_out) -> Tensor(grad_x)
  args : (Tensor out, Tensor grad_x_grad)
1663
  output : Tensor(grad_out_grad)
1664
  infer_meta :
1665 1666
    func : UnchangedInferMeta
    param : [out]
1667 1668
  kernel :
    func : relu_double_grad
1669
  inplace : (grad_x_grad -> grad_out_grad)
1670

1671 1672 1673
- backward_api : relu_grad
  forward : relu (Tensor x) -> Tensor(out)
  args : (Tensor out, Tensor out_grad)
H
hong 已提交
1674 1675 1676
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
1677
    param : [out]
H
hong 已提交
1678
  kernel :
1679
    func : relu_grad
1680
  backward: relu_double_grad
P
pangyoki 已提交
1681
  inplace : (out_grad -> x_grad)
H
hong 已提交
1682

1683 1684 1685 1686 1687 1688 1689 1690 1691
- backward_api : reshape_double_grad
  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
W
wanghuancoder 已提交
1692
  no_need_buffer : grad_out
1693
  inplace : (grad_x_grad -> grad_out_grad)
1694

1695
- backward_api : reshape_grad
1696
  forward : reshape (Tensor x, IntArray shape) -> Tensor(out), Tensor(xshape)
1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707
  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
1708
  backward : reshape_double_grad
1709
  inplace : (out_grad -> x_grad)
1710

1711 1712 1713 1714 1715 1716 1717 1718 1719
- backward_api : roi_align_grad
  forward : roi_align (Tensor x, Tensor boxes, Tensor boxes_num, int pooled_height, int pooled_width, float spatial_scale, int sampling_ratio, bool aligned) -> Tensor(out)
  args : (Tensor x, Tensor boxes, Tensor boxes_num, Tensor out_grad, int pooled_height, int pooled_width, float spatial_scale, int sampling_ratio, bool aligned)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : roi_align_grad
1720
    data_type : boxes
W
wanghuancoder 已提交
1721
  no_need_buffer : x
1722 1723
  optional : boxes_num

Z
zyfncg 已提交
1724 1725 1726 1727 1728 1729 1730 1731 1732
- backward_api : roi_pool_grad
  forward : roi_pool (Tensor x, Tensor boxes, Tensor boxes_num, int pooled_height, int pooled_width, float spatial_scale) -> Tensor(out), Tensor(arg_max)
  args : (Tensor x, Tensor boxes, Tensor boxes_num, Tensor arg_max, Tensor out_grad, int pooled_height, int pooled_width, float spatial_scale)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : roi_pool_grad
1733
    data_type : x
Z
zyfncg 已提交
1734 1735
  optional : boxes_num

F
From00 已提交
1736 1737 1738 1739 1740 1741 1742 1743 1744 1745
- backward_api : roll_grad
  forward : roll(Tensor x, IntArray shifts, int64_t[] axis) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, IntArray shifts, int64_t[] axis)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : roll_grad
    data_type : x
H
hong 已提交
1746
  no_need_buffer : x
F
From00 已提交
1747

1748 1749 1750 1751 1752 1753 1754 1755 1756
- backward_api : round_grad
  forward : round(Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [out_grad]
  kernel :
    func : round_grad
P
pangyoki 已提交
1757
  inplace : (out_grad -> x_grad)
1758

1759 1760 1761 1762 1763 1764 1765 1766 1767
- backward_api : rsqrt_double_grad
  forward : rsqrt_grad (Tensor out, Tensor grad_out) -> Tensor(grad_x)
  args : (Tensor out, Tensor grad_x, Tensor grad_x_grad)
  output : Tensor(out_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [out, out]
  kernel :
    func : rsqrt_double_grad
1768
  inplace : (grad_x_grad -> grad_out_grad)
1769

Z
zyfncg 已提交
1770 1771 1772 1773 1774 1775 1776 1777 1778
- backward_api : rsqrt_grad
  forward : rsqrt (Tensor x) -> Tensor(out)
  args : (Tensor out, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : rsqrt_grad
1779
  backward : rsqrt_double_grad
P
pangyoki 已提交
1780
  inplace : (out_grad -> x_grad)
Z
zyfncg 已提交
1781

1782 1783 1784 1785 1786 1787 1788
- backward_api : scale_double_grad
  forward : scale_grad (Tensor grad_out, Scalar scale, float bias, bool bias_after_scale) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, Scalar scale=1.0, float bias=0.0, bool bias_after_scale=true)
  output : Tensor(grad_out_grad)
  invoke : scale(grad_x_grad, scale, 0.0, bias_after_scale)
  backward : scale_triple_grad

1789 1790
- backward_api : scale_grad
  forward : scale (Tensor x, Scalar scale, float bias, bool bias_after_scale) -> Tensor(out)
1791
  args : (Tensor out_grad, Scalar scale=1.0, float bias=0.0, bool bias_after_scale=true)
H
hong 已提交
1792
  output : Tensor(x_grad)
1793
  invoke : scale(out_grad, scale, 0.0, bias_after_scale)
1794
  backward : scale_double_grad
1795
  inplace : (out_grad -> x_grad)
1796 1797 1798 1799 1800 1801

- backward_api : scale_triple_grad
  forward : scale_double_grad (Tensor grad_grad_x, Scalar scale, float bias, bool bias_after_scale) -> Tensor(grad_grad_out)
  args : (Tensor grad_grad_out_grad, Scalar scale=1.0, float bias=0.0, bool bias_after_scale=true)
  output : Tensor(grad_grad_x_grad)
  invoke : scale(grad_grad_out_grad, scale, 0.0, bias_after_scale)
H
hong 已提交
1802 1803 1804 1805 1806 1807 1808 1809 1810 1811

- backward_api : scatter_grad
  forward : scatter (Tensor x, Tensor index, Tensor updates, bool overwrite) -> Tensor(out)
  args : (Tensor index, Tensor updates, Tensor out_grad, bool overwrite)
  output : Tensor(x_grad), Tensor(updates_grad)
  infer_meta :
    func : ScatterGradInferMeta
    param : [index, updates, out_grad, overwrite]
  kernel :
    func : scatter_grad
H
hong 已提交
1812
  no_need_buffer : updates
H
hong 已提交
1813 1814

- backward_api : scatter_nd_add_grad
1815
  forward : scatter_nd_add (Tensor x, Tensor index, Tensor updates) -> Tensor(out)
H
hong 已提交
1816 1817 1818 1819 1820 1821
  args : (Tensor index, Tensor updates, Tensor out_grad)
  output : Tensor(x_grad), Tensor(updates_grad)
  infer_meta :
    func : ScatterNdAddGradInferMeta
    param : [index, updates, out_grad]
  kernel :
1822
    func : scatter_nd_add_grad
H
hong 已提交
1823
  no_need_buffer : updates
H
hong 已提交
1824

1825 1826 1827 1828
- backward_api : segment_pool_grad
  forward : segment_pool (Tensor x, Tensor segment_ids, str pooltype) -> Tensor(out), Tensor(summed_ids)
  args : (Tensor x, Tensor segment_ids, Tensor out, Tensor summed_ids, Tensor out_grad, str pooltype)
  output : Tensor(x_grad)
H
hong 已提交
1829
  infer_meta :
1830 1831
    func : UnchangedInferMeta
    param : [x]
H
hong 已提交
1832
  kernel :
1833
    func : segment_pool_grad
1834
    data_type : x
H
hong 已提交
1835
  optional : summed_ids
H
hong 已提交
1836

1837 1838 1839 1840
- backward_api : selu_grad
  forward : selu (Tensor x, float scale, float alpha) -> Tensor(out)
  args : (Tensor out, Tensor out_grad, float scale, float alpha)
  output : Tensor(x_grad)
H
hong 已提交
1841
  infer_meta :
1842 1843
    func : UnchangedInferMeta
    param : [out]
H
hong 已提交
1844
  kernel :
1845
    func : selu_grad
H
hong 已提交
1846

1847 1848 1849 1850 1851 1852 1853 1854
- backward_api : sigmoid_cross_entropy_with_logits_grad
  forward : sigmoid_cross_entropy_with_logits (Tensor x, Tensor label, bool normalize, int ignore_index) -> Tensor(out)
  args : (Tensor x, Tensor label, Tensor out_grad, bool normalize, int ignore_index)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
1855
    func : sigmoid_cross_entropy_with_logits_grad
P
pangyoki 已提交
1856
  inplace : (out_grad -> x_grad)
H
hong 已提交
1857

1858 1859 1860 1861 1862 1863 1864 1865 1866 1867
- backward_api : sigmoid_double_grad
  forward : sigmoid_grad (Tensor out, Tensor fwd_grad_out) -> Tensor(grad_x)
  args : (Tensor out, Tensor fwd_grad_out, Tensor grad_x_grad)
  output : Tensor(out_grad), Tensor(fwd_grad_out_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [out, fwd_grad_out]
  kernel :
    func : sigmoid_double_grad
  backward : sigmoid_triple_grad
1868
  inplace : (grad_x_grad -> fwd_grad_out_grad)
1869

1870 1871 1872 1873 1874 1875 1876 1877 1878
- backward_api : sigmoid_grad
  forward : sigmoid (Tensor x) -> Tensor(out)
  args : (Tensor out, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : sigmoid_grad
1879
  backward : sigmoid_double_grad
P
pangyoki 已提交
1880
  inplace : (out_grad -> x_grad)
1881 1882 1883 1884 1885 1886 1887 1888 1889

- backward_api : sigmoid_triple_grad
  forward : sigmoid_double_grad (Tensor out, Tensor fwd_grad_out, Tensor grad_grad_x) -> Tensor(grad_out), Tensor(grad_grad_out)
  args : (Tensor out, Tensor fwd_grad_out, Tensor grad_grad_x, Tensor grad_out_grad, Tensor grad_grad_out_grad)
  output : Tensor(out_grad), Tensor(fwd_grad_out_grad), Tensor(grad_grad_x_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param : [out, fwd_grad_out, grad_grad_x]
  kernel :
1890
    func : sigmoid_triple_grad
1891
  optional : grad_grad_out_grad
1892
  inplace : (grad_grad_x -> fwd_grad_out_grad)
H
hong 已提交
1893

1894 1895 1896
- backward_api : silu_grad
  forward : silu (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
H
hong 已提交
1897 1898 1899 1900 1901
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
1902
    func : silu_grad
P
pangyoki 已提交
1903
  inplace : (out_grad -> x_grad)
H
hong 已提交
1904

1905 1906 1907 1908
- backward_api : sin_grad
  forward : sin (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
H
hong 已提交
1909
  infer_meta :
1910 1911
    func : UnchangedInferMeta
    param : [x]
H
hong 已提交
1912
  kernel :
1913
    func : sin_grad
P
pangyoki 已提交
1914
  inplace : (out_grad -> x_grad)
H
hong 已提交
1915

1916 1917 1918 1919
- backward_api : sinh_grad
  forward : sinh (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
H
hong 已提交
1920
  infer_meta :
1921 1922
    func : UnchangedInferMeta
    param : [x]
H
hong 已提交
1923
  kernel :
1924
    func : sinh_grad
P
pangyoki 已提交
1925
  inplace : (out_grad -> x_grad)
H
hong 已提交
1926

H
hong 已提交
1927 1928 1929 1930 1931 1932 1933 1934 1935
- backward_api : slice_grad
  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
H
hong 已提交
1936
  no_need_buffer : input
H
hong 已提交
1937

1938 1939 1940 1941
- backward_api : soft_shrink_grad
  forward : soft_shrink (Tensor x, float lambda) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, float lambda)
  output : Tensor(x_grad)
H
hong 已提交
1942 1943
  infer_meta :
    func : UnchangedInferMeta
1944
    param : [x]
H
hong 已提交
1945
  kernel :
1946
    func : soft_shrink_grad
P
pangyoki 已提交
1947
  inplace : (out_grad -> x_grad)
H
hong 已提交
1948

1949 1950 1951 1952 1953 1954 1955 1956 1957
- backward_api : softmax_grad
  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
1958
    use_gpudnn : true
H
hong 已提交
1959

1960
- backward_api : split_grad
1961
  forward : split (Tensor x, IntArray num_or_sections, Scalar axis) -> Tensor[](out)
H
hong 已提交
1962
  args : (Tensor[] out_grad, Scalar axis = -1)
1963 1964 1965
  output : Tensor(x_grad)
  invoke : concat( out_grad, axis)
# TODO(zhangyunfei) The config of double grad and triple grad will be supported in the future.
H
hong 已提交
1966

1967 1968 1969 1970 1971 1972 1973 1974 1975
- backward_api : sqrt_double_grad
  forward : sqrt_grad (Tensor out, Tensor grad_out) -> Tensor(grad_x)
  args : (Tensor out, Tensor grad_x, Tensor grad_x_grad)
  output : Tensor(out_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [out, out]
  kernel :
    func : sqrt_double_grad
1976
  inplace : (grad_x_grad -> grad_out_grad)
1977

1978 1979 1980 1981 1982 1983 1984 1985 1986
- backward_api : sqrt_grad
  forward : sqrt (Tensor x) -> Tensor(out)
  args : (Tensor out, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : sqrt_grad
1987
  backward : sqrt_double_grad
P
pangyoki 已提交
1988
  inplace : (out_grad -> x_grad)
1989 1990 1991 1992 1993 1994 1995 1996 1997 1998

- backward_api : square_double_grad
  forward : square_grad (Tensor x, Tensor grad_out) -> Tensor(grad_x)
  args : (Tensor x, Tensor grad_out, Tensor grad_x_grad)
  output : Tensor(x_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, x]
  kernel :
    func : square_double_grad
1999
  inplace : (grad_x_grad -> grad_out_grad)
2000 2001 2002 2003 2004 2005 2006 2007 2008 2009

- backward_api : square_grad
  forward : square (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : square_grad
2010
  backward : square_double_grad
P
pangyoki 已提交
2011
  inplace : (out_grad -> x_grad)
2012

2013 2014 2015 2016 2017 2018
- backward_api : squeeze_double_grad
  forward : squeeze_grad(Tensor xshape, Tensor grad_out, int[] axes) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, int[] axes)
  output : Tensor(grad_out_grad)
  invoke: squeeze(grad_x_grad, axes)

2019
- backward_api : squeeze_grad
2020
  forward : squeeze(Tensor x, int[] axes) -> Tensor(out), Tensor(xshape)
2021 2022 2023 2024 2025 2026 2027
  args : (Tensor xshape, Tensor out_grad, int[] axes)
  output : Tensor(x_grad)
  infer_meta :
    func : KernelWithXShapeInferMeta
    param: [xshape]
  kernel :
    func : squeeze_grad
2028
  inplace : (out_grad -> x_grad)
2029
  backward: squeeze_double_grad
2030

2031 2032 2033
- backward_api : stack_grad
  forward : stack (Tensor[] x, int axis) -> Tensor(out)
  args : (Tensor[] x, Tensor out_grad, int axis)
2034 2035 2036 2037 2038 2039 2040
  output : Tensor[](x_grad){x.size()}
  infer_meta :
    func : StackGradInferMeta
    param: [out_grad, axis]
  kernel :
    func : stack_grad
    param : [out_grad, axis]
2041 2042
  no_need_buffer : x

2043 2044 2045 2046 2047 2048 2049 2050 2051
- backward_api : strided_slice_grad
  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
H
hong 已提交
2052
  no_need_buffer : x
2053

2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064
- backward_api : subtract_double_grad
  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
2065
  inplace : (grad_x_grad -> grad_out_grad)
2066

2067 2068 2069 2070 2071 2072 2073 2074 2075
- backward_api : subtract_grad
  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
H
hong 已提交
2076
  no_need_buffer : x, y
2077
  backward : subtract_double_grad
2078
  inplace : (out_grad -> x_grad)
H
hong 已提交
2079

2080 2081 2082 2083 2084 2085 2086
- backward_api : sum_double_grad
  forward : sum_grad (Tensor x, Tensor grad_out, int64_t[] dims, bool keep_dim, bool reduce_all=false) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, int64_t[] dims={}, bool keep_dim=false)
  output : Tensor(grad_out_grad)
  invoke : sum(grad_x_grad, dims, grad_x_grad.dtype(), keep_dim)
  backward : sum_triple_grad

F
From00 已提交
2087
- backward_api : sum_grad
2088
  forward : sum (Tensor x, int64_t[] dims={}, DataType out_dtype=DataType::UNDEFINED, bool keep_dim=false) -> Tensor(out)
F
From00 已提交
2089 2090 2091 2092 2093 2094 2095
  args : (Tensor x, Tensor out_grad, int64_t[] dims, bool keep_dim, bool reduce_all=false)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : sum_grad
W
wanghuancoder 已提交
2096
  no_need_buffer : x
2097 2098 2099 2100 2101 2102
  backward : sum_double_grad

- backward_api : sum_triple_grad
  forward : sum_double_grad (Tensor grad_grad_x, int64_t[] dims={}, bool keep_dim=false) -> Tensor(grad_grad_out)
  args : (Tensor grad_grad_x, Tensor grad_grad_out_grad, int64_t[] dims={}, bool keep_dim=false, bool reduce_all=false)
  output : Tensor(grad_grad_x_grad)
2103
  invoke : sum_grad(grad_grad_x, grad_grad_out_grad, dims, keep_dim, reduce_all, grad_grad_x_grad)
F
From00 已提交
2104

2105 2106 2107 2108 2109 2110 2111 2112 2113
- backward_api : swish_grad
  forward : swish (Tensor x, float beta=1.0) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, float bete=1.0)
  output : Tensor(x_grad)
  infer_meta :
    func : GeneralUnaryGradInferMeta
    param : [x]
  kernel :
    func : swish_grad
P
pangyoki 已提交
2114
  inplace : (out_grad -> x_grad)
2115

2116 2117 2118 2119 2120 2121 2122 2123 2124
- backward_api : take_along_axis_grad
  forward : take_along_axis (Tensor x, Tensor index, int axis) -> Tensor(out)
  args : (Tensor x, Tensor index, Tensor out_grad, int axis)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : take_along_axis_grad
H
hong 已提交
2125

2126 2127 2128
- backward_api : tan_grad
  forward : tan (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
H
hong 已提交
2129 2130 2131 2132 2133
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
2134
    func : tan_grad
P
pangyoki 已提交
2135
  inplace : (out_grad -> x_grad)
H
hong 已提交
2136

2137 2138 2139 2140 2141 2142 2143 2144 2145 2146
- backward_api : tanh_double_grad
  forward : tanh_grad (Tensor out, Tensor grad_out) -> Tensor(grad_x)
  args : (Tensor out, Tensor grad_out, Tensor grad_x_grad)
  output : Tensor(out_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [out, out]
  kernel :
    func : tanh_double_grad
  backward : tanh_triple_grad
2147
  inplace : (grad_x_grad -> grad_out_grad)
2148

2149 2150 2151 2152
- backward_api : tanh_grad
  forward : tanh (Tensor x) -> Tensor(out)
  args : (Tensor out, Tensor out_grad)
  output : Tensor(x_grad)
H
hong 已提交
2153
  infer_meta :
2154 2155
    func : UnchangedInferMeta
    param : [out]
H
hong 已提交
2156
  kernel :
2157
    func : tanh_grad
2158
  backward : tanh_double_grad
P
pangyoki 已提交
2159
  inplace : (out_grad -> x_grad)
H
hong 已提交
2160

2161 2162
- backward_api : tanh_shrink_grad
  forward : tanh_shrink (Tensor x) -> Tensor(out)
Z
zhangbo9674 已提交
2163 2164 2165 2166 2167 2168
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
2169
    func : tanh_shrink_grad
P
pangyoki 已提交
2170
  inplace : (out_grad -> x_grad)
H
hong 已提交
2171

2172 2173 2174 2175 2176 2177 2178 2179 2180
- backward_api : tanh_triple_grad
  forward : tanh_double_grad (Tensor out, Tensor grad_out_forward, Tensor grad_x_grad_forward) -> Tensor(grad_out_new), Tensor(grad_out_grad)
  args : (Tensor out, Tensor grad_out_forward, Tensor grad_x_grad_forward, Tensor grad_out_new_grad, Tensor grad_out_grad_grad)
  output : Tensor(out_grad), Tensor(grad_out_forward_grad), Tensor(grad_x_grad_forward_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param : [out, out, grad_x_grad_forward]
  kernel :
    func : tanh_triple_grad
2181
  inplace : (grad_x_grad_forward -> grad_out_forward_grad)
2182

2183 2184 2185 2186 2187 2188 2189 2190 2191
- backward_api : thresholded_relu_grad
  forward : thresholded_relu (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 : thresholded_relu_grad
P
pangyoki 已提交
2192
  inplace : (out_grad -> x_grad)
H
hong 已提交
2193

2194 2195 2196 2197 2198 2199 2200 2201 2202
- backward_api : tile_double_grad
  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)
  infer_meta :
    func : TileInferMeta
  kernel :
    func : tile

2203
- backward_api : tile_grad
2204 2205
  forward : tile (Tensor x, IntArray repeat_times) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, IntArray repeat_times)
2206 2207 2208 2209 2210 2211
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : tile_grad
H
hong 已提交
2212
  no_need_buffer : x
2213
  backward : tile_double_grad
H
hong 已提交
2214

2215 2216 2217 2218 2219 2220 2221 2222 2223 2224
- backward_api : top_k_grad
  forward : top_k (Tensor x, Scalar k, int axis = -1, bool largest = true, bool sorted = true) -> Tensor(out), Tensor(indices)
  args : (Tensor x, Tensor indices, Tensor out_grad, Scalar k = -1, int axis = -1, bool largest = true, bool sorted = true)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : top_k_grad

2225 2226 2227 2228 2229 2230 2231 2232 2233
- backward_api : trace_grad
  forward : trace (Tensor x, int offset, int axis1, int axis2) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, int offset, int axis1, int axis2)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : trace_grad
H
hong 已提交
2234
  no_need_buffer : x
H
hong 已提交
2235

2236 2237 2238 2239 2240 2241
- backward_api : transpose_double_grad
  forward : transpose_grad (Tensor grad_out, int[] axis) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, int[] axis)
  output : Tensor(grad_out_grad)
  invoke : transpose(grad_x_grad, axis)

2242 2243 2244 2245 2246 2247 2248 2249 2250
- backward_api : transpose_grad
  forward : transpose (Tensor x, int[] axis) -> Tensor(out)
  args : (Tensor out_grad, int[] axis)
  output : Tensor(x_grad)
  infer_meta :
    func : TransposeGradInferMeta
    param : [out_grad, axis]
  kernel :
    func : transpose_grad
2251
  backward : transpose_double_grad
H
hong 已提交
2252

H
hong 已提交
2253 2254 2255 2256 2257 2258 2259 2260 2261 2262
- backward_api : triangular_solve_grad
  forward : triangular_solve (Tensor x, Tensor y, bool upper, bool tranpose, bool unitriangular) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out, Tensor out_grad, bool upper, bool tranpose, bool unitriangular)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : triangular_solve_grad

F
From00 已提交
2263 2264 2265 2266 2267 2268 2269 2270 2271 2272
- backward_api : tril_triu_grad
  forward : tril_triu(Tensor x,  int diagonal,  bool lower) -> Tensor(out)
  args : (Tensor out_grad,  int diagonal,  bool lower)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out_grad]
  kernel :
    func : tril_triu_grad

2273 2274 2275 2276 2277 2278 2279 2280 2281
- backward_api : trunc_grad
  forward : trunc (Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out_grad]
  kernel :
    func : trunc_grad
H
hong 已提交
2282

2283 2284 2285 2286 2287 2288
- backward_api : unbind_grad
  forward : unbind (Tensor input, int axis) -> Tensor[](out)
  args : (Tensor[] out_grad, int axis)
  output : Tensor(input_grad)
  invoke : stack(out_grad, axis)

2289 2290 2291 2292 2293 2294 2295 2296 2297
- backward_api : unfold_grad
  forward : unfold (Tensor x, int[] kernel_sizes, int[] strides, int[] paddings, int[] dilations) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, int[] kernel_sizes, int[] strides, int[] paddings, int[] dilations)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : unfold_grad
H
hong 已提交
2298
  no_need_buffer : x
H
hong 已提交
2299

2300 2301 2302 2303 2304 2305
- backward_api : unsqueeze_double_grad
  forward : unsqueeze_grad(Tensor xshape, Tensor grad_out, IntArray axes) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, IntArray axes)
  output : Tensor(grad_out_grad)
  invoke : unsqueeze(grad_x_grad, axes)

2306
- backward_api : unsqueeze_grad
2307
  forward : unsqueeze(Tensor x, IntArray axes) -> Tensor(out), Tensor(xshape)
2308
  args : (Tensor xshape, Tensor out_grad, IntArray axes)
2309 2310 2311 2312 2313 2314
  output : Tensor(x_grad)
  infer_meta :
    func : KernelWithXShapeInferMeta
    param: [xshape]
  kernel :
    func : unsqueeze_grad
2315
    param: [xshape, out_grad]
2316
  inplace : (out_grad -> x_grad)
2317
  backward : unsqueeze_double_grad
2318

2319 2320 2321 2322 2323 2324 2325 2326 2327
- backward_api : where_grad
  forward : where (Tensor condition, Tensor x, Tensor y) -> Tensor(out)
  args : (Tensor condition, Tensor x, Tensor y, Tensor out_grad)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : where_grad
H
hong 已提交
2328
  no_need_buffer : x, y