backward.yaml 62.0 KB
Newer Older
1 2 3
# This file is designed for backward C++ operators associated with
# the operator in ops.yaml.

4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
- backward_op : acos_grad
  forward : acos (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : acos_grad
  inplace : (out_grad -> x_grad)

- backward_op : acosh_grad
  forward : acosh (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : acosh_grad
  inplace : (out_grad -> x_grad)

26 27 28 29 30 31 32 33 34 35
- backward_op : addmm_grad
  forward : addmm (Tensor input, Tensor x, Tensor y, float beta=1.0, float alpha=1.0) -> Tensor(out)
  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

36 37 38 39 40 41 42 43 44 45 46
- backward_op : affine_grid_grad
  forward : affine_grid (Tensor input, IntArray output_shape={}, bool align_corners=true) -> Tensor(output)
  args : (Tensor input, Tensor output_grad, IntArray output_shape, bool align_corners=true)
  output : Tensor(input_grad)
  infer_meta :
    func : AffineGridGradInferMeta
    param : [output_grad, output_shape, align_corners]
  kernel :
    func : affine_grid_grad
    param : [output_grad, output_shape, align_corners]

47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
- backward_op : angle_grad
  forward : angle (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : angle_grad

- backward_op : 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
    data_type : out_grad
  no_need_buffer : x

69 70 71 72 73 74 75 76 77 78 79 80
- backward_op : as_complex_grad
  forward : as_complex (Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  invoke : as_real(out_grad)

- backward_op : as_real_grad
  forward : as_real (Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  invoke : as_complex(out_grad)

81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
- backward_op : 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
  inplace : (out_grad -> x_grad)

- backward_op : 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
  inplace : (out_grad -> x_grad)

103
- backward_op : atan2_grad
104 105 106 107 108 109 110 111 112
  forward : atan2 (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 : atan2_grad

113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
- backward_op : 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
  inplace : (out_grad -> x_grad)

- backward_op : 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
  inplace : (out_grad -> x_grad)

135 136 137 138 139 140 141 142 143 144 145
- backward_op : 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
  inplace : (out_grad -> input_grad)

146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
- backward_op : bicubic_interp_grad
  forward : bicubic_interp (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout="NCHW", int out_d=0, int out_h=0, int out_w=0, float[] scale={}, str interp_method="bilinear", bool align_corners=true, int align_mode=1) -> Tensor(output)
  args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, Tensor output_grad, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  optional: out_size, size_tensor, scale_tensor
  no_need_buffer : x
  kernel :
    func : bicubic_interp_grad
    data_type : output_grad
  data_transform :
    skip_transform : out_size, size_tensor, scale_tensor

- backward_op : bilinear_interp_grad
  forward : bilinear_interp (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout="NCHW", int out_d=0, int out_h=0, int out_w=0, float[] scale={}, str interp_method="bilinear", bool align_corners=true, int align_mode=1) -> Tensor(output)
  args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, Tensor output_grad, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  no_need_buffer : x
  optional: out_size, size_tensor, scale_tensor
  kernel :
    func : bilinear_interp_grad
    data_type : output_grad
  data_transform :
    skip_transform : out_size, size_tensor, scale_tensor

176 177 178 179 180 181 182 183 184 185
- backward_op : bmm_grad
  forward : bmm (Tensor x, Tensor y) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out_grad)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : BmmGradInferMeta
  kernel :
    func : bmm_grad
    data_type : out_grad

186 187 188 189 190 191 192 193 194 195 196 197 198
- backward_op : broadcast_tensors_grad
  forward : broadcast_tensors (Tensor[] input) -> Tensor[](out)
  args : (Tensor[] input, Tensor[] out_grad)
  output : Tensor[](input_grad)
  infer_meta :
    func : UnchangedMultiInferMeta
    param : [input]
  kernel :
    func : broadcast_tensors_grad
    param : [input, out_grad]
    data_type : out_grad
  no_need_buffer : input

199 200 201 202 203 204 205 206 207 208 209
- backward_op : 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
  inplace : (out_grad -> x_grad)

210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
- backward_op : 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
  inplace : (grad_x_grad -> grad_out_grad)

- backward_op : 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
  inplace : (out_grad -> x_grad)

233
- backward_op : cholesky_grad
234 235 236 237 238 239 240 241 242
  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

243
- backward_op : cholesky_solve_grad
244 245 246 247 248 249 250 251 252
  forward : cholesky_solve (Tensor x, Tensor y, bool upper) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out, Tensor out_grad, bool upper)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : cholesky_solve_grad

253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
- backward_op : 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
    data_type : x

- backward_op : 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
  backward : clip_double_grad
  inplace : (out_grad -> x_grad)

276 277 278 279 280 281 282 283 284 285
- backward_op : complex_grad
  forward : complex (Tensor real, Tensor imag) -> Tensor(out)
  args : (Tensor real, Tensor imag, Tensor out_grad)
  output : Tensor(real_grad), Tensor(imag_grad)
  infer_meta :
    func : ComplexGradInferMeta
  kernel :
    func : complex_grad
    data_type : real

286 287 288 289 290 291
- backward_op : conj_grad
  forward : conj (Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  invoke : conj(out_grad)

292 293 294 295 296 297 298 299 300
- backward_op : cos_double_grad
  forward : cos_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 : cos_double_grad
301
  optional: grad_out
302 303 304
  backward : cos_triple_grad
  inplace : (grad_x_grad -> grad_out_grad)

305 306 307 308 309 310 311 312 313
- backward_op : 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
314
  backward : cos_double_grad
315
  composite : cos_grad(x, out_grad, x_grad)
316 317
  inplace : (out_grad -> x_grad)

318 319 320 321 322 323 324 325 326
- backward_op : cos_triple_grad
  forward : cos_double_grad (Tensor x, Tensor grad_out_forward, Tensor grad_x_grad_forward) -> Tensor(grad_x), Tensor(grad_out_grad)
  args : (Tensor x, Tensor grad_out_forward, Tensor grad_x_grad_forward, Tensor grad_x_grad, Tensor grad_out_grad_grad)
  output : Tensor(x_grad), Tensor(grad_out_forward_grad), Tensor(grad_x_grad_forward_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param : [x, x, grad_x_grad_forward]
  kernel :
    func : cos_triple_grad
327
  optional: grad_out_forward, grad_x_grad_forward, grad_out_grad_grad
328 329
  inplace : (grad_x_grad_forward -> grad_out_forward_grad)

330 331 332 333 334 335 336 337 338 339 340
- backward_op : 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
  inplace : (out_grad -> x_grad)

341 342 343 344 345 346 347 348 349 350
- backward_op : crop_grad
  forward : crop (Tensor x, IntArray shape, IntArray offsets) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, IntArray offsets)
  output : Tensor(x_grad)
  infer_meta :
    func : CropGradInferMeta
  kernel :
    func : crop_grad
    data_type : x

351
- backward_op : cross_grad
352 353 354 355 356 357 358 359 360 361
  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
    data_type : out_grad

362 363 364 365 366 367 368 369 370 371
- backward_op : 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

372 373 374 375 376 377 378 379 380 381 382
- backward_op : 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 :
    func : determinant_grad
    data_type : out_grad

383
- backward_op : diag_grad
384 385 386 387 388 389 390 391 392 393 394
  forward : diag (Tensor x, int offset, float padding_value) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, int offset)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : diag_grad
    data_type : out_grad
  no_need_buffer : x

395
- backward_op : diagonal_grad
396 397 398 399 400 401 402 403 404 405 406
  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
    data_type : out_grad
  no_need_buffer : x

407
- backward_op : digamma_grad
408 409 410 411 412 413 414 415 416
  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

417
- backward_op : dist_grad
418 419 420 421 422 423 424 425 426
  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

427
- backward_op : dot_grad
428 429 430 431 432 433 434 435 436 437
  forward : dot (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 : dot_grad
    data_type : out_grad

438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
- backward_op : eig_grad
  forward : eig (Tensor x) -> 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 : EigGradInferMeta
  kernel :
    func : eig_grad
    data_type : out_v

- backward_op : 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
    data_type : out_v

459 460 461 462 463 464 465 466 467 468
- backward_op : eigvalsh_grad
  forward : eigvalsh (Tensor x, str uplo = "L", bool is_test = false) -> Tensor(eigenvalues), Tensor(eigenvectors)
  args : (Tensor eigenvectors, Tensor eigenvalues_grad, str uplo, bool is_test)
  output : Tensor(x_grad)
  infer_meta :
    func : EigvalshGradInferMeta
  kernel :
    func : eigvalsh_grad
    data_type : eigenvectors

469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
- backward_op : 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
  inplace : (grad_x_grad -> grad_out_grad)

- backward_op : 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
  backward : elu_double_grad
  inplace : (out_grad -> x_grad)

492
- backward_op : erf_grad
493 494 495 496 497 498 499 500 501
  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
G
GGBond8488 已提交
502
  composite : erf_grad(x, out_grad, x_grad)
503

504
- backward_op : erfinv_grad
505 506 507 508 509 510 511 512
  forward : erfinv (Tensor x) -> Tensor(out)
  args : (Tensor out, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : erfinv_grad
513

514 515 516 517 518 519 520 521 522 523
- backward_op : 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
  inplace : (out_grad -> x_grad)
524
  composite : exp_grad(out, out_grad, x_grad)
525

526 527 528 529 530 531 532 533 534 535 536
- backward_op : 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
  inplace : (out_grad -> x_grad)

537
- backward_op : fft_c2c_grad
F
Feiyu Chan 已提交
538 539 540 541 542 543 544 545 546
  forward: fft_c2c(Tensor x, int64_t[] axes, str normalization, bool forward) -> Tensor(out)
  args : (Tensor out_grad, int64_t[] axes, str normalization, bool forward)
  output: Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out_grad]
  kernel :
    func : fft_c2c_grad

547
- backward_op : fft_c2r_grad
F
Feiyu Chan 已提交
548 549 550 551 552 553 554 555 556
  forward: fft_c2r(Tensor x, int64_t[] axes, str normalization, bool forward, int64_t last_dim_size) -> Tensor(out)
  args : (Tensor out_grad, int64_t[] axes, str normalization, bool forward, int64_t last_dim_size)
  output: Tensor(x_grad)
  infer_meta :
    func : FFTC2RGradInferMeta
  kernel :
    func : fft_c2r_grad
    data_type: out_grad

557
- backward_op : fft_r2c_grad
F
Feiyu Chan 已提交
558 559 560 561 562 563 564 565 566 567 568
  forward: fft_r2c(Tensor x, int64_t[] axes, str normalization, bool forward, bool onesided) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, int64_t[] axes, str normalization, bool forward, bool onesided)
  output: Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : fft_r2c_grad
    data_type: out_grad
  no_need_buffer: x

569 570 571 572 573 574 575 576 577
- backward_op : fill_diagonal_grad
  forward : fill_diagonal (Tensor x, float value=0, int offset=0, bool wrap=false) -> Tensor(out)
  args : (Tensor out_grad, float value, int offset, bool wrap)
  output : Tensor(x_grad)
  infer_meta :
    func : FillDiagonalGradInferMeta
  kernel :
    func : fill_diagonal_grad

578 579 580 581 582 583 584 585 586 587
- backward_op : fill_diagonal_tensor_grad
  forward : fill_diagonal_tensor (Tensor x, Tensor y, int64_t offset, int dim1, int dim2) -> Tensor(out)
  args : (Tensor out_grad, int64_t offset, int dim1, int dim2)
  output : Tensor(x_grad)
  infer_meta :
    func : FillDiagonalTensorGradInferMeta
  kernel :
    func : fill_diagonal_tensor_grad
  inplace : (out_grad -> x_grad)

588
- backward_op : flash_attn_grad
S
sneaxiy 已提交
589
  forward : flash_attn (Tensor q, Tensor k, Tensor v, float dropout = 0.0, bool causal = false, bool return_softmax = false, bool is_test = false) -> Tensor(out), Tensor(softmax), Tensor(softmax_lse), Tensor(seed_offset)
590 591 592 593 594 595 596
  args : (Tensor q, Tensor k, Tensor v, Tensor out, Tensor softmax_lse, Tensor seed_offset, Tensor out_grad, float dropout = 0.0, bool causal = false)
  output : Tensor(q_grad), Tensor(k_grad), Tensor(v_grad)
  infer_meta :
    func : FlashAttnGradInferMeta
    param : [q, k, v]
  kernel :
    func : flash_attn_grad
C
Chitsing KUI 已提交
597 598
    data_type: q

599
- backward_op : flash_attn_unpadded_grad
S
sneaxiy 已提交
600
  forward : flash_attn_unpadded (Tensor q, Tensor k, Tensor v, Tensor cu_seqlens_q, Tensor cu_seqlens_k, int64_t max_seqlen_q, int64_t max_seqlen_k, float scale, float dropout = 0.0, bool causal = false, bool return_softmax = false, bool is_test = false) -> Tensor(out), Tensor(softmax), Tensor(softmax_lse), Tensor(seed_offset)
C
Chitsing KUI 已提交
601 602 603 604 605 606
  args : (Tensor q, Tensor k, Tensor v, Tensor cu_seqlens_q, Tensor cu_seqlens_k, Tensor out, Tensor softmax_lse, Tensor seed_offset, Tensor out_grad, int64_t max_seqlen_q, int64_t max_seqlen_k, float scale, float dropout = 0.0, bool causal = false)
  output : Tensor(q_grad), Tensor(k_grad), Tensor(v_grad)
  infer_meta :
    func : FlashAttnGradInferMeta
    param : [q, k, v]
  kernel :
607
    func : flash_attn_unpadded_grad
C
Chitsing KUI 已提交
608
    data_type: q
609

610 611 612 613 614 615
- backward_op : flip_grad
  forward : flip (Tensor x, int[] axis) -> Tensor(out)
  args : (Tensor out_grad, int[] axis)
  output : Tensor(x_grad)
  invoke : flip(out_grad, axis)

616 617 618 619 620 621 622 623 624
- backward_op : 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
625
  composite : floor_grad(out_grad, x_grad)
626 627
  inplace : (out_grad -> x_grad)

628 629 630 631 632 633 634 635 636 637 638 639
- backward_op : fold_grad
  forward: fold (Tensor x, int[] output_sizes, int[] kernel_sizes, int[] strides, int[] paddings, int[] dilations) -> Tensor(out)
  args: (Tensor x, Tensor out_grad, int[] output_sizes, int[] kernel_sizes, int[] strides, int[] paddings, int[] dilations)
  output: Tensor(x_grad)
  infer_meta:
    func: UnchangedInferMeta
    param : [x]
  kernel:
    func: fold_grad
    data_type : out_grad
  no_need_buffer : x

640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657
- backward_op : frame_grad
  forward : frame(Tensor x, int frame_length, int hop_length, int axis=-1) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, int frame_length, int hop_length, int axis)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : frame_grad

- backward_op : 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 : GatherNdGradInferMeta
  kernel :
    func : gather_nd_grad
658
  composite : gather_nd_grad(x, index, out_grad, x_grad)
659 660
  no_need_buffer : x

661 662 663 664 665 666 667 668 669
- backward_op : 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
C
cxxly 已提交
670
  composite: gelu_grad(x, out_grad, approximate, x_grad)
671

672 673 674 675 676 677 678 679 680 681 682
- backward_op : grid_sample_grad
  forward : grid_sample (Tensor x, Tensor grid, str mode, str padding_mode, bool align_corners) -> Tensor(out)
  args : (Tensor x, Tensor grid, Tensor out_grad, str mode, str padding_mode, bool align_corners)
  output : Tensor(x_grad), Tensor(grid_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, grid]
  kernel :
    func : grid_sample_grad
    data_type : x

683 684 685 686 687 688 689 690 691
- backward_op : 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
  kernel :
    func : gumbel_softmax_grad

692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713
- backward_op : hardshrink_grad
  forward : hardshrink (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
  inplace : (out_grad -> x_grad)

- backward_op : hardsigmoid_grad
  forward : hardsigmoid (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
  inplace : (out_grad -> x_grad)

714 715 716 717 718 719 720 721 722 723 724
- backward_op : hardtanh_grad
  forward : hardtanh (Tensor x, float t_min=0, float t_max=24) -> 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 : hardtanh_grad
  inplace : (out_grad -> x_grad)

725 726 727 728 729 730 731 732 733 734
- backward_op : 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

735 736 737 738 739 740 741 742 743 744
- backward_op : imag_grad
  forward : imag (Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : RealAndImagGradInferMeta
  kernel :
    func : imag_grad
    data_type : complex(out_grad)

745 746 747 748 749 750 751 752 753 754 755
- backward_op : index_add_grad
  forward : index_add(Tensor x, Tensor index,  Tensor add_value, int axis=0) -> Tensor(out)
  args : (Tensor index, Tensor add_value, Tensor out_grad, int axis)
  output : Tensor(x_grad), Tensor(add_value_grad)
  infer_meta :
    func : IndexAddGradInferMeta
  kernel :
    func : index_add_grad
    data_type : out_grad
  inplace : (out_grad -> x_grad)

756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788
- backward_op : 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
  no_need_buffer : x

- backward_op : index_select_grad
  forward : index_select(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 : index_select_grad
    data_type : out_grad
  no_need_buffer : x

- backward_op : inverse_grad
  forward : inverse(Tensor x) -> Tensor(out)
  args : (Tensor out, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta:
    func : InverseGradInferMeta
  kernel :
    func : inverse_grad

789 790 791 792 793 794 795 796 797 798 799
- backward_op : kldiv_loss_grad
  forward : kldiv_loss(Tensor x, Tensor label, str reduction="mean") -> 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
  no_need_buffer : x

800 801 802 803 804 805 806 807 808 809 810
- backward_op : 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

811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831
- backward_op : 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
    data_type : out_grad

- backward_op : 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

832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852
- backward_op : leaky_relu_double_grad
  forward : leaky_relu_grad (Tensor x, Tensor grad_out, float negative_slope) -> Tensor(grad_x)
  args : (Tensor x, Tensor grad_x_grad, float negative_slope)
  output : Tensor(grad_out_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [grad_x_grad]
  kernel :
    func : leaky_relu_double_grad
  inplace : (grad_x_grad -> grad_out_grad)

- backward_op : leaky_relu_grad
  forward : leaky_relu (Tensor x, float negative_slope) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, float negative_slope)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : leaky_relu_grad
  backward : leaky_relu_double_grad
J
Jiabin Yang 已提交
853
  composite: leaky_relu_grad(x, out_grad, negative_slope, x_grad)
854 855
  inplace : (out_grad -> x_grad)

856 857 858 859 860 861 862 863 864 865
- backward_op : lerp_grad
  forward : lerp (Tensor x, Tensor y, Tensor weight) -> Tensor(out)
  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

866
- backward_op : lgamma_grad
867 868 869 870 871 872 873 874 875
  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

876 877 878 879 880 881 882 883 884 885 886 887 888 889 890
- backward_op : linear_interp_grad
  forward : linear_interp (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout="NCHW", int out_d=0, int out_h=0, int out_w=0, float[] scale={}, str interp_method="bilinear", bool align_corners=true, int align_mode=1) -> Tensor(output)
  args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, Tensor output_grad, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  optional: out_size, size_tensor, scale_tensor
  no_need_buffer : x
  kernel :
    func : linear_interp_grad
    data_type : output_grad
  data_transform :
    skip_transform : out_size, size_tensor, scale_tensor

891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923
- backward_op : 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
  inplace : (out_grad -> x_grad)

- backward_op : 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
  inplace : (out_grad -> x_grad)

- backward_op : 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
  inplace : (out_grad -> x_grad)

924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944
- backward_op : 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
  inplace : (grad_x_grad -> grad_out_grad)

- backward_op : 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
  backward : log_double_grad
945
  composite : log_grad(x, out_grad, x_grad)
946 947
  inplace : (out_grad -> x_grad)

948 949 950 951 952 953 954 955 956 957
- backward_op : 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

958 959 960 961 962 963 964 965 966 967 968
- backward_op : log_softmax_grad
  forward : log_softmax(Tensor x,  int axis = -1) -> 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
    data_type : out_grad

969 970 971 972 973 974 975 976 977 978
- backward_op : logcumsumexp_grad
  forward : logcumsumexp(Tensor x, int axis=-1, bool flatten=false, bool exclusive=false, bool reverse=false) -> 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

979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999
- backward_op : 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

- backward_op : logsigmoid_grad
  forward : logsigmoid (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : logsigmoid_grad
  inplace : (out_grad -> x_grad)

1000 1001 1002 1003 1004 1005 1006 1007 1008
- backward_op : lu_unpack_grad
  forward : lu_unpack (Tensor x, Tensor y, bool unpack_ludata = true, bool unpack_pivots = true) -> Tensor(pmat), Tensor(l), Tensor(u)
  args : (Tensor x, Tensor y, Tensor l, Tensor u, Tensor pmat, Tensor l_grad, Tensor u_grad, bool unpack_ludata, bool unpack_pivots)
  output : Tensor(x_grad)
  infer_meta :
    func : LUUnpackGradInferMeta
  kernel :
    func : lu_unpack_grad

1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019
- backward_op : margin_cross_entropy_grad
  forward : margin_cross_entropy (Tensor logits, Tensor label, bool return_softmax=false, int ring_id=0, int rank=0, int nranks=1, float margin1=1.0f, float margin2=0.5f, float margin3=0.0f, float scale=64.0f) -> Tensor(softmax), Tensor(loss)
  args : (Tensor logits, Tensor label, Tensor softmax, Tensor loss_grad, bool return_softmax, int ring_id, int rank, int nranks, float margin1, float margin2, float margin3, float scale)
  output : Tensor(logits_grad)
  infer_meta :
    func : MarginCrossEntropyGradInferMeta
  kernel :
    func : margin_cross_entropy_grad
    data_type : softmax
  inplace : (softmax -> logits_grad)

1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
- backward_op : 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
  no_need_buffer : x

- backward_op : 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

- backward_op : 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

1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062
- backward_op : memory_efficient_attention_grad
  forward : memory_efficient_attention (Tensor query, Tensor key, Tensor value, Tensor bias, Tensor cu_seqlens_q, Tensor cu_seqlens_k, Tensor causal_diagonal, Tensor seqlen_k, Scalar max_seqlen_q, Scalar max_seqlen_k, bool causal, double dropout_p, float scale, bool is_test) -> Tensor(output), Tensor(logsumexp), Tensor(seed_and_offset)
  args : (Tensor query, Tensor key, Tensor value, Tensor bias, Tensor cu_seqlens_q, Tensor cu_seqlens_k, Tensor output, Tensor logsumexp, Tensor seed_and_offset, Tensor output_grad, Scalar max_seqlen_q, Scalar max_seqlen_k, bool causal, double dropout_p, float scale)
  output : Tensor(query_grad), Tensor(key_grad), Tensor(value_grad), Tensor(bias_grad)
  infer_meta :
    func : MemoryEfficientAttentionGradInferMeta
  kernel :
    func : memory_efficient_attention_grad
    data_type : output_grad
  optional : bias, cu_seqlens_q, cu_seqlens_k

1063 1064 1065 1066 1067 1068 1069 1070 1071 1072
- backward_op : meshgrid_grad
  forward : meshgrid (Tensor[] inputs) -> Tensor[](outputs)
  args : (Tensor[] inputs, Tensor[] outputs_grad)
  output : Tensor[](inputs_grad){inputs.size()}
  infer_meta :
    func : MeshgridGradInferMeta
  kernel :
    func : meshgrid_grad
    data_type : outputs_grad

1073 1074 1075 1076 1077 1078 1079 1080 1081 1082
- backward_op : mode_grad
  forward : mode(Tensor x,  int axis = -1,  bool keepdim = false) -> 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

1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103
- backward_op : multi_dot_grad
  forward : multi_dot (Tensor[] x) -> Tensor(out)
  args : (Tensor[] x, Tensor out_grad)
  output : Tensor[](x_grad) {x.size()}
  infer_meta :
    func : MultiDotGradInferMeta
  kernel :
    func : multi_dot_grad

- backward_op : multiplex_grad
  forward : multiplex (Tensor[] inputs, Tensor index) -> Tensor(out)
  args : (Tensor[] inputs, Tensor index, Tensor out_grad)
  output : Tensor[](inputs_grad){inputs.size()}
  infer_meta :
    func : MultiplexGradInferMeta
    param : [index, out_grad]
  kernel :
    func : multiplex_grad
    param : [index, out_grad]
    data_type : out_grad

1104
- backward_op : mv_grad
1105 1106 1107 1108 1109 1110 1111 1112 1113
  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]
  kernel :
    func : mv_grad

Z
zyfncg 已提交
1114 1115 1116 1117 1118 1119 1120 1121 1122
- backward_op : nanmedian_grad
  forward : nanmedian (Tensor x, IntArray axis, bool keepdim) -> Tensor(out), Tensor(medians)
  args : (Tensor x, Tensor medians, Tensor out_grad, IntArray axis, bool keepdim)
  output : Tensor(x_grad)
  infer_meta :
    func : NanmedianGradInferMeta
  kernel :
    func : nanmedian_grad

1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137
- backward_op : nearest_interp_grad
  forward : nearest_interp (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout="NCHW", int out_d=0, int out_h=0, int out_w=0, float[] scale={}, str interp_method="bilinear", bool align_corners=true, int align_mode=1) -> Tensor(output)
  args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, Tensor output_grad, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  optional: out_size, size_tensor, scale_tensor
  no_need_buffer : x
  kernel :
    func : nearest_interp_grad
    data_type : output_grad
  data_transform :
    skip_transform : out_size, size_tensor, scale_tensor

1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148
- backward_op : nll_loss_grad
  forward : nll_loss (Tensor input, Tensor label, Tensor weight, int64_t ignore_index = -100, str reduction = "mean") -> 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)
  infer_meta :
    func : NllLossGradInferMeta
  kernel :
    func : nll_loss_grad
    data_type : input
  optional : weight

1149 1150 1151 1152 1153 1154 1155 1156 1157 1158
- backward_op : overlap_add_grad
  forward : overlap_add(Tensor x, int hop_length, int axis) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, int hop_length, int axis)
  output : Tensor(x_grad)
  infer_meta :
    func : OverlapAddGradInferMeta
  kernel :
    func : overlap_add_grad
    data_type : x

1159 1160 1161 1162 1163 1164 1165 1166 1167 1168
- backward_op : p_norm_grad
  forward : p_norm(Tensor x,  float porder=2,  int axis=-1,  float epsilon=1.0e-12f,  bool keepdim=false,  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 : GeneralUnaryGradInferMeta
    param: [x]
  kernel :
    func : p_norm_grad

1169 1170 1171 1172 1173 1174 1175 1176 1177
- backward_op : pixel_shuffle_grad
  forward : pixel_shuffle (Tensor x, int upscale_factor=1, str data_format="NCHW") -> 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

1178
- backward_op : poisson_grad
1179 1180 1181 1182 1183 1184 1185 1186 1187
  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

1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224
- backward_op : pow_double_grad
  forward : pow_grad(Tensor x, Tensor grad_out, Scalar y) -> Tensor(grad_x)
  args : (Tensor x, Tensor grad_out, Tensor grad_x_grad, Scalar y)
  output : Tensor(x_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param: [x, grad_out]
  kernel :
    func : pow_double_grad
    data_type : x
  backward : pow_triple_grad
  inplace : (grad_x_grad -> x_grad)

- backward_op : pow_grad
  forward : pow(Tensor x, Scalar y=1.0f) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, Scalar y=-1)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  kernel :
    func : pow_grad
    data_type : out_grad
  backward: pow_double_grad
  inplace : (out_grad -> x_grad)

- backward_op : pow_triple_grad
  forward : pow_double_grad(Tensor x, Tensor grad_out, Tensor grad_grad_x, Scalar y) -> Tensor(grad_x), Tensor(grad_grad_out)
  args : (Tensor x, Tensor grad_out, Tensor grad_grad_x, Tensor grad_x_grad, Tensor grad_grad_out_grad, Scalar y)
  output : Tensor(x_grad), Tensor(grad_out_grad), Tensor(grad_grad_x_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param: [x, grad_out, grad_grad_x]
  kernel :
    func : pow_triple_grad
    data_type : x

1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235
- backward_op : prelu_grad
  forward : prelu(Tensor x, Tensor alpha, str data_format="NCHW", str mode="all") -> 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 : PreluGradInferMeta
    param: [x, alpha]
  kernel :
    func : prelu_grad
    data_type : x

1236 1237 1238 1239 1240 1241 1242 1243 1244 1245
- backward_op : put_along_axis_grad
  forward : put_along_axis (Tensor arr, Tensor indices, Tensor value, int axis, str reduce = "assign") -> Tensor(out)
  args : (Tensor arr, Tensor indices, Tensor out_grad, int axis, str reduce)
  output : Tensor(arr_grad), Tensor(value_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [arr, indices]
  kernel :
    func : put_along_axis_grad

1246 1247 1248 1249 1250 1251 1252 1253 1254 1255
- backward_op : qr_grad
  forward : qr (Tensor x, str mode = "reduced") -> Tensor(q), Tensor(r)
  args : (Tensor x, Tensor q, Tensor r, Tensor q_grad, Tensor r_grad, str mode)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : qr_grad

1256 1257 1258 1259 1260 1261 1262 1263 1264 1265
- backward_op : real_grad
  forward : real (Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : RealAndImagGradInferMeta
  kernel :
    func : real_grad
    data_type : complex(out_grad)

1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276
- backward_op : 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
  inplace : (out_grad -> x_grad)

1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297
- backward_op : relu_double_grad
  forward : relu_grad (Tensor out, Tensor grad_out) -> Tensor(grad_x)
  args : (Tensor out, Tensor grad_x_grad)
  output : Tensor(grad_out_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : relu_double_grad
  inplace : (grad_x_grad -> grad_out_grad)

- backward_op : relu_grad
  forward : relu (Tensor x) -> Tensor(out)
  args : (Tensor out, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : relu_grad
  backward: relu_double_grad
J
Jiabin Yang 已提交
1298
  composite: relu_grad(out, out_grad, x_grad)
1299 1300
  inplace : (out_grad -> x_grad)

1301 1302 1303 1304 1305 1306 1307 1308 1309 1310
- backward_op : renorm_grad
  forward : renorm (Tensor x, float p, int axis, float max_norm) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, float p, int axis, float max_norm)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out_grad]
  kernel :
    func : renorm_grad

1311 1312 1313 1314 1315 1316 1317 1318 1319 1320
- backward_op : 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
1321
  composite : roll_grad(x, out_grad, shifts, axis, x_grad)
1322 1323
  no_need_buffer : x

1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334
- backward_op : 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
  inplace : (out_grad -> x_grad)

1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357
- backward_op : 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
  inplace : (grad_x_grad -> grad_out_grad)

- backward_op : 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
  backward : rsqrt_double_grad
  inplace : (out_grad -> x_grad)

HappyHeavyRain's avatar
HappyHeavyRain 已提交
1358 1359 1360 1361 1362 1363
- backward_op : scale_grad
  forward : scale (Tensor x, Scalar scale, float bias, bool bias_after_scale) -> Tensor(out)
  args : (Tensor out_grad, Scalar scale=1.0)
  output : Tensor(x_grad)
  invoke : scale(out_grad, scale, 0.0f, true)

1364 1365 1366 1367 1368 1369 1370 1371 1372 1373
- backward_op : scatter_grad
  forward : scatter (Tensor x, Tensor index, Tensor updates, bool overwrite=true) -> 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
  no_need_buffer : updates
Z
zxcd 已提交
1374
  composite: scatter_grad(index, updates, out_grad, overwrite, x_grad, updates_grad)
1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397

- backward_op : scatter_nd_add_grad
  forward : scatter_nd_add (Tensor x, Tensor index, Tensor updates) -> Tensor(out)
  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 :
    func : scatter_nd_add_grad
  no_need_buffer : updates

- backward_op : selu_grad
  forward : selu (Tensor x, float scale=1.0507009873554804934193349852946, float alpha=1.6732632423543772848170429916717) -> Tensor(out)
  args : (Tensor out, Tensor out_grad, float scale, float alpha)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : selu_grad
    data_type : out

1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421
- backward_op : send_u_recv_grad
  forward : send_u_recv (Tensor x, Tensor src_index, Tensor dst_index, str reduce_op = "SUM", IntArray 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 reduce_op = "SUM")
  output : Tensor(x_grad)
  infer_meta :
    func : GeneralUnaryGradInferMeta
    param : [x]
  kernel :
    func : send_u_recv_grad
    data_type : out_grad
  optional: out, dst_count

- backward_op : send_ue_recv_grad
  forward : send_ue_recv (Tensor x, Tensor y, Tensor src_index, Tensor dst_index, str message_op="ADD", str reduce_op="SUM", IntArray out_size={0}) -> Tensor(out), Tensor(dst_count)
  args : (Tensor x, Tensor y, Tensor src_index, Tensor dst_index, Tensor out, Tensor dst_count, Tensor out_grad, str message_op, str reduce_op)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : send_ue_recv_grad
    data_type : out_grad
  optional: out, dst_count

1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432
- backward_op : send_uv_grad
  forward : send_uv (Tensor x, Tensor y, Tensor src_index, Tensor dst_index, str message_op = "ADD") -> Tensor(out)
  args: (Tensor x, Tensor y, Tensor src_index, Tensor dst_index, Tensor out_grad, str message_op = "ADD")
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : send_uv_grad
    data_type : x

1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443
- backward_op : sigmoid_cross_entropy_with_logits_grad
  forward : sigmoid_cross_entropy_with_logits (Tensor x, Tensor label, bool normalize=false, int ignore_index=-100) -> 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 :
    func : sigmoid_cross_entropy_with_logits_grad
  inplace : (out_grad -> x_grad)

1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466
- backward_op : 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
  inplace : (grad_x_grad -> fwd_grad_out_grad)

- backward_op : 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
  backward : sigmoid_double_grad
  inplace : (out_grad -> x_grad)
1467
  composite : sigmoid_grad(out, out_grad, x_grad)
1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480

- backward_op : 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 :
    func : sigmoid_triple_grad
  optional : grad_grad_out_grad
  inplace : (grad_grad_x -> fwd_grad_out_grad)

HappyHeavyRain's avatar
HappyHeavyRain 已提交
1481 1482 1483 1484 1485 1486
- backward_op : sign_grad
  forward : sign (Tensor x) -> Tensor(out)
  args : (Tensor out_grad)
  output : Tensor(x_grad)
  invoke : scale(out_grad, 0.0f, 0.0f, true)

1487 1488 1489 1490 1491 1492 1493 1494 1495
- backward_op : silu_grad
  forward : silu (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : silu_grad
J
Jiabin Yang 已提交
1496
  composite : silu_grad(x, out_grad, x_grad)
1497 1498
  inplace : (out_grad -> x_grad)

1499 1500 1501 1502 1503 1504 1505 1506 1507
- backward_op : sin_double_grad
  forward : sin_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 : sin_double_grad
1508
  optional: grad_out
1509
  backward : sin_triple_grad
1510 1511
  inplace : (grad_x_grad -> grad_out_grad)

1512 1513 1514 1515 1516 1517 1518 1519 1520
- backward_op : sin_grad
  forward : sin (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : sin_grad
1521
  backward : sin_double_grad
1522
  composite : sin_grad(x, out_grad, x_grad)
1523 1524
  inplace : (out_grad -> x_grad)

1525 1526 1527 1528 1529 1530 1531 1532 1533
- backward_op : sin_triple_grad
  forward : sin_double_grad (Tensor x, Tensor grad_out_forward, Tensor grad_x_grad_forward) -> Tensor(grad_x), Tensor(grad_out_grad)
  args : (Tensor x, Tensor grad_out_forward, Tensor grad_x_grad_forward, Tensor grad_x_grad, Tensor grad_out_grad_grad)
  output : Tensor(x_grad), Tensor(grad_out_forward_grad), Tensor(grad_x_grad_forward_grad)
  infer_meta :
    func : GeneralTernaryGradInferMeta
    param : [x, x, grad_x_grad_forward]
  kernel :
    func : sin_triple_grad
1534
  optional: grad_out_forward, grad_x_grad_forward, grad_out_grad_grad
1535 1536
  inplace : (grad_x_grad_forward -> grad_out_forward_grad)

1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547
- backward_op : sinh_grad
  forward : sinh (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : sinh_grad
  inplace : (out_grad -> x_grad)

1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558
- backward_op : slogdet_grad
  forward : slogdet (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : GeneralUnaryGradInferMeta
    param : [x]
  kernel :
    func : slogdet_grad
    data_type : out_grad

W
will-jl944 已提交
1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569
- backward_op : softplus_double_grad
  forward : softplus_grad (Tensor x, Tensor grad_out, float beta, float threshold) -> Tensor(grad_x)
  args : (Tensor x, Tensor grad_out, Tensor grad_x_grad, float beta, float threshold)
  output : Tensor(x_grad), Tensor(grad_out_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, x]
  kernel :
    func : softplus_double_grad
  inplace : (grad_x_grad -> grad_out_grad)

1570 1571 1572 1573 1574 1575 1576 1577 1578
- backward_op : softplus_grad
  forward : softplus (Tensor x, float beta, float threshold) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, float beta, float threshold)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : softplus_grad
W
will-jl944 已提交
1579
  backward : softplus_double_grad
1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603
  inplace : (out_grad -> x_grad)

- backward_op : softshrink_grad
  forward : softshrink (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 : softshrink_grad
  inplace : (out_grad -> x_grad)

- backward_op : softsign_grad
  forward : softsign (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : softsign_grad
  inplace : (out_grad -> x_grad)

1604
- backward_op : solve_grad
1605 1606 1607 1608 1609 1610 1611 1612 1613
  forward : solve (Tensor x, Tensor y) -> Tensor(out)
  args : (Tensor x, Tensor y, Tensor out, Tensor out_grad)
  output : Tensor(x_grad), Tensor(y_grad)
  infer_meta :
    func : GeneralBinaryGradInferMeta
    param : [x, y]
  kernel :
    func : solve_grad

1614 1615 1616 1617 1618 1619 1620 1621 1622 1623
- backward_op : spectral_norm_grad
  forward : spectral_norm (Tensor weight, Tensor u, Tensor v, int dim = 0, int power_iters = 1, float eps=1e-12f) -> Tensor(out)
  args : (Tensor weight, Tensor u, Tensor v, Tensor out_grad, int dim, int power_iters, float eps)
  output : Tensor(weight_grad)
  infer_meta :
    func : SpectralNormGradInferMeta
  kernel :
    func : spectral_norm_grad
    data_type : weight

1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643
- backward_op : 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
  inplace : (grad_x_grad -> grad_out_grad)

- backward_op : 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
1644
  composite : sqrt_grad(out, out_grad, x_grad)
1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670
  backward : sqrt_double_grad
  inplace : (out_grad -> x_grad)

- backward_op : 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
  inplace : (grad_x_grad -> grad_out_grad)

- backward_op : 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
  backward : square_double_grad
  inplace : (out_grad -> x_grad)

1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690
- backward_op : squeeze_double_grad
  forward : squeeze_grad(Tensor xshape, Tensor grad_out, IntArray axis) -> Tensor(grad_x)
  args : (Tensor grad_x_grad, IntArray axis)
  output : Tensor(grad_out_grad), Tensor(xshape)
  invoke: squeeze(grad_x_grad, axis)
  intermediate : xshape

- backward_op : squeeze_grad
  forward : squeeze(Tensor x, IntArray axis) -> Tensor(out), Tensor(xshape)
  args : (Tensor xshape, Tensor out_grad, IntArray axis)
  output : Tensor(x_grad)
  infer_meta :
    func : KernelWithXShapeInferMeta
    param: [xshape]
  kernel :
    func : squeeze_grad
    data_type : out_grad
  inplace : (out_grad -> x_grad)
  backward: squeeze_double_grad

1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703
- backward_op : stack_grad
  forward : stack (Tensor[] x, int axis) -> Tensor(out)
  args : (Tensor[] x, Tensor out_grad, int axis)
  output : Tensor[](x_grad){x.size()}
  infer_meta :
    func : StackGradInferMeta
    param: [out_grad, axis]
  kernel :
    func : stack_grad
    param : [out_grad, axis]
    data_type : out_grad
  no_need_buffer : x

Z
zyfncg 已提交
1704 1705 1706 1707 1708 1709 1710 1711 1712 1713
- backward_op : stanh_grad
  forward : stanh(Tensor x, float scale_a, float scale_b) -> Tensor(out)
  args : (Tensor x, Tensor out_grad, float scale_a, float scale_b)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : stanh_grad

1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734
- backward_op : svd_grad
  forward : svd (Tensor x, bool full_matrices = false) -> Tensor(u), Tensor(s), Tensor(vh)
  args : (Tensor x, Tensor u, Tensor vh, Tensor s, Tensor u_grad, Tensor vh_grad, Tensor s_grad, bool full_matrices)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : svd_grad
  optional: u_grad, vh_grad, s_grad

- backward_op : take_along_axis_grad
  forward : take_along_axis (Tensor arr, Tensor indices, int axis) -> Tensor(out)
  args : (Tensor arr, Tensor indices, Tensor out_grad, int axis)
  output : Tensor(arr_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [arr]
  kernel :
    func : take_along_axis_grad

1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745
- backward_op : tan_grad
  forward : tan (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : tan_grad
  inplace : (out_grad -> x_grad)

1746 1747 1748 1749 1750 1751 1752 1753 1754
- backward_op : 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
1755
  composite : tanh_double_grad(out, grad_out, grad_x_grad, out_grad, grad_out_grad)
1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767
  backward : tanh_triple_grad
  inplace : (grad_x_grad -> grad_out_grad)

- backward_op : tanh_grad
  forward : tanh (Tensor x) -> Tensor(out)
  args : (Tensor out, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [out]
  kernel :
    func : tanh_grad
J
Jiabin Yang 已提交
1768
  composite : tanh_grad(out, out_grad, x_grad)
1769 1770 1771
  backward : tanh_double_grad
  inplace : (out_grad -> x_grad)

1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782
- backward_op : tanh_shrink_grad
  forward : tanh_shrink (Tensor x) -> Tensor(out)
  args : (Tensor x, Tensor out_grad)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : tanh_shrink_grad
  inplace : (out_grad -> x_grad)

1783 1784 1785 1786 1787 1788 1789 1790 1791 1792
- backward_op : 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
  inplace : (grad_x_grad_forward -> grad_out_forward_grad)
1793
  optional : grad_out_new_grad, grad_out_grad_grad
1794

1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805
- backward_op : 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
  inplace : (out_grad -> x_grad)

1806 1807 1808 1809 1810 1811 1812 1813 1814 1815
- backward_op : topk_grad
  forward : topk (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, int axis, bool largest, bool sorted)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [x]
  kernel :
    func : topk_grad
    data_type : out_grad
Z
zqw_1997 已提交
1816
  composite : topk_grad(x, indices, out_grad, k, axis, largest, sorted, x_grad)
1817

1818
- backward_op : trace_grad
1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829
  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
    data_type : out_grad
  no_need_buffer : x

1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844
- backward_op : trilinear_interp_grad
  forward : trilinear_interp (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, str data_layout="NCHW", int out_d=0, int out_h=0, int out_w=0, float[] scale={}, str interp_method="bilinear", bool align_corners=true, int align_mode=1) -> Tensor(output)
  args : (Tensor x, Tensor out_size, Tensor[] size_tensor, Tensor scale_tensor, Tensor output_grad, str data_layout, int out_d, int out_h, int out_w, float[] scale, str interp_method, bool align_corners, int align_mode)
  output : Tensor(x_grad)
  infer_meta :
    func : UnchangedInferMeta
    param: [x]
  optional: out_size, size_tensor, scale_tensor
  no_need_buffer : x
  kernel :
    func : trilinear_interp_grad
    data_type : output_grad
  data_transform :
    skip_transform : out_size, size_tensor, scale_tensor

1845
- backward_op : trunc_grad
1846
  forward : trunc (Tensor input) -> Tensor(out)
1847
  args : (Tensor out_grad)
1848
  output : Tensor(input_grad)
1849 1850 1851 1852 1853
  infer_meta :
    func : UnchangedInferMeta
    param : [out_grad]
  kernel :
    func : trunc_grad
1854

1855 1856 1857 1858 1859 1860
- backward_op : 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)

1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871
- backward_op : 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
    data_type : out_grad
  no_need_buffer : x
1872

1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893
- backward_op : 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), Tensor(xshape)
  invoke : unsqueeze(grad_x_grad, axes)
  intermediate : xshape

- backward_op : unsqueeze_grad
  forward : unsqueeze(Tensor x, IntArray axes) -> Tensor(out), Tensor(xshape)
  args : (Tensor xshape, Tensor out_grad, IntArray axes)
  output : Tensor(x_grad)
  infer_meta :
    func : KernelWithXShapeInferMeta
    param: [xshape]
  kernel :
    func : unsqueeze_grad
    param : [xshape, out_grad]
    data_type : out_grad
  inplace : (out_grad -> x_grad)
  backward : unsqueeze_double_grad

1894 1895 1896 1897 1898 1899 1900 1901 1902
- backward_op : unstack_grad
  forward : unstack (Tensor x, int axis=0, int num=0) -> Tensor[](out)
  args : (Tensor[] out_grad, int axis)
  output : Tensor(x_grad)
  infer_meta :
    func : UnStackGradInferMeta
  kernel :
    func : unstack_grad

1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915
- backward_op : warpctc_grad
  forward : warpctc (Tensor logits, Tensor label, Tensor logits_length, Tensor labels_length, int blank = 0, bool norm_by_times = false) -> Tensor(loss), Tensor(warpctcgrad)
  args : (Tensor logits, Tensor logits_length, Tensor warpctcgrad, Tensor loss_grad, int blank, bool norm_by_times)
  output : Tensor(logits_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [logits]
  kernel :
    func : warpctc_grad
    data_type : loss_grad
  optional : logits_length
  no_need_buffer : logits

H
Hui Zhang 已提交
1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926
- backward_op : warprnnt_grad
  forward : warprnnt (Tensor input, Tensor label, Tensor input_lengths, Tensor label_lengths, int blank = 0, float fastemit_lambda = 0.0) -> Tensor(loss), Tensor(warprnntgrad)
  args : (Tensor input, Tensor input_lengths, Tensor warprnntgrad, Tensor loss_grad, int blank = 0, float fastemit_lambda = 0.0)
  output : Tensor(input_grad)
  infer_meta :
    func : UnchangedInferMeta
    param : [input]
  kernel :
    func : warprnnt_grad
  no_need_buffer : input

1927 1928 1929 1930 1931 1932 1933 1934 1935 1936
- backward_op : 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
  no_need_buffer : x, y