forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
native_functions.yaml
3083 lines (2253 loc) · 106 KB
/
native_functions.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
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
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
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
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# See README.md in this directory for more guidance
# Temporary type cast operators. These are needed to trace type-casts now since
# Type's are not supported in the IR. Instead, we call down to these
# specialized operators for each datatype.
# TODO: remove when we have Type support in the IR
- func: _cast_Byte(Tensor self, bool non_blocking=false) -> Tensor
variants: function
- func: _cast_Char(Tensor self, bool non_blocking=false) -> Tensor
variants: function
- func: _cast_Double(Tensor self, bool non_blocking=false) -> Tensor
variants: function
- func: _cast_Float(Tensor self, bool non_blocking=false) -> Tensor
variants: function
- func: _cast_Int(Tensor self, bool non_blocking=false) -> Tensor
variants: function
- func: _cast_Long(Tensor self, bool non_blocking=false) -> Tensor
variants: function
- func: _cast_Short(Tensor self, bool non_blocking=false) -> Tensor
variants: function
- func: _cast_Half(Tensor self, bool non_blocking=false) -> Tensor
variants: function
- func: _cudnn_ctc_loss(Tensor log_probs, Tensor targets, IntList input_lengths, IntList target_lengths, int64_t blank, bool deterministic) -> (Tensor, Tensor)
dispatch:
CUDA: _cudnn_ctc_loss
- func: _cudnn_rnn_flatten_weight(TensorList weight_arr, int64_t weight_stride0, int64_t input_size, int64_t mode, int64_t hidden_size, int64_t num_layers, bool batch_first, bool bidirectional) -> Tensor
dispatch:
CUDA: _cudnn_rnn_flatten_weight
- func: _cudnn_rnn(Tensor input, TensorList weight, int64_t weight_stride0, Tensor? weight_buf, Tensor hx, Tensor? cx, int64_t mode, int64_t hidden_size, int64_t num_layers, bool batch_first, double dropout, bool train, bool bidirectional, IntList batch_sizes, BoolTensor? dropout_state) -> (Tensor, Tensor, Tensor, Tensor, Tensor)
dispatch:
CUDA: _cudnn_rnn
- func: _cudnn_rnn_backward(Tensor input, TensorList weight, int64_t weight_stride0, Tensor weight_buf, Tensor hx, Tensor? cx, Tensor output, Tensor? grad_output, Tensor? grad_hy, Tensor? grad_cy, int64_t mode, int64_t hidden_size, int64_t num_layers, bool batch_first, double dropout, bool train, bool bidirectional, IntList batch_sizes, BoolTensor? dropout_state, Tensor reserve, std::array<bool,4> output_mask) -> (Tensor, Tensor, Tensor, TensorList)
dispatch:
CUDA: _cudnn_rnn_backward
- func: _cudnn_init_dropout_state(double dropout, bool train, int64_t dropout_seed, TensorOptions options) -> Tensor
dispatch:
CUDA: _cudnn_init_dropout_state
- func: _fused_dropout(Tensor self, double p, Generator* generator=nullptr) -> (Tensor, Tensor)
variants: function
dispatch:
CUDA: fused_dropout_cuda
- func: _masked_scale(Tensor self, Tensor mask, double scale) -> Tensor
variants: function
dispatch:
CUDA: masked_scale_cuda
- func: _reshape_from_tensor(Tensor self, Tensor shape) -> Tensor
- func: _shape_as_tensor(Tensor self) -> Tensor
- func: dropout(Tensor input, double p, bool train) -> Tensor
- func: dropout_(Tensor self, double p, bool train) -> Tensor
- func: feature_dropout(Tensor input, double p, bool train) -> Tensor
- func: feature_dropout_(Tensor self, double p, bool train) -> Tensor
- func: alpha_dropout(Tensor input, double p, bool train) -> Tensor
- func: alpha_dropout_(Tensor self, double p, bool train) -> Tensor
- func: feature_alpha_dropout(Tensor input, double p, bool train) -> Tensor
- func: feature_alpha_dropout_(Tensor self, double p, bool train) -> Tensor
- func: abs(Tensor self) -> Tensor
variants: function, method
- func: abs_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _abs__cpu
CUDA: _abs__cuda
- func: abs_out(Tensor result, Tensor self) -> Tensor
dispatch:
CPU: _abs_out_cpu
CUDA: _abs_out_cuda
- func: acos(Tensor self) -> Tensor
variants: function, method
- func: acos_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _acos__cpu
CUDA: _acos__cuda
- func: acos_out(Tensor result, Tensor self) -> Tensor
dispatch:
CPU: _acos_out_cpu
CUDA: _acos_out_cuda
- func: avg_pool1d(Tensor self, IntList[1] kernel_size, IntList[1] stride={}, IntList[1] padding=0, bool ceil_mode=false, bool count_include_pad=true) -> Tensor
- func: adaptive_avg_pool1d(Tensor self, IntList[1] output_size) -> Tensor
- func: adaptive_max_pool1d(Tensor self, IntList[1] output_size) -> (Tensor, Tensor)
- func: add(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor
variants: function, method
- func: add_(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor
variants: method
- func: add_out(Tensor result, Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor
# For C++ only, until we have conversion from C++ numbers to Tensor
- func: add(Tensor self, Scalar other, Scalar alpha=1) -> Tensor
variants: function, method
- func: add_(Tensor self, Scalar other, Scalar alpha=1) -> Tensor
variants: method
- func: addmv(Tensor self, Tensor mat, Tensor vec, *, Scalar beta=1, Scalar alpha=1) -> Tensor
variants: function, method
- func: addmv_(Tensor self, Tensor mat, Tensor vec, *, Scalar beta=1, Scalar alpha=1) -> Tensor
variants: function, method
- func: addmv_out(Tensor result, Tensor self, Tensor mat, Tensor vec, *, Scalar beta=1, Scalar alpha=1) -> Tensor
- func: addr(Tensor self, Tensor vec1, Tensor vec2, *, Scalar beta=1, Scalar alpha=1) -> Tensor
variants: function, method
- func: addr_(Tensor self, Tensor vec1, Tensor vec2, *, Scalar beta=1, Scalar alpha=1) -> Tensor
variants: method
- func: addr_out(Tensor result, Tensor self, Tensor vec1, Tensor vec2, *, Scalar beta=1, Scalar alpha=1) -> Tensor
- func: all(Tensor self, int64_t dim, bool keepdim=false) -> Tensor
variants: function, method
- func: all_out(Tensor result, Tensor self, int64_t dim, bool keepdim=false) -> Tensor
- func: allclose(Tensor self, Tensor other, double rtol=1e-5, double atol=1e-8, bool equal_nan=False) -> bool
variants: function, method
- func: any(Tensor self, int64_t dim, bool keepdim=false) -> Tensor
variants: function, method
- func: any_out(Tensor result, Tensor self, int64_t dim, bool keepdim=false) -> Tensor
- func: arange(Scalar start, Scalar end, TensorOptions options={}) -> Tensor
- func: arange(Scalar start, Scalar end, Scalar step, TensorOptions options={}) -> Tensor
- func: arange_out(Tensor result, Scalar start, Scalar end) -> Tensor
- func: arange_out(Tensor result, Scalar start, Scalar end, Scalar step) -> Tensor
- func: arange(Scalar end, TensorOptions options={}) -> Tensor
- func: arange_out(Tensor result, Scalar end) -> Tensor
# This function is a temporary hack to allow tracing of arange like constructs with dynamic
# bounds on arange. Normal arange is not traceable because it does not take any tensor inputs;
# if the range you need is based on another tensor, calling this function directly will
# preserve tracing. Get rid of this when arange can directly take tensors for bounds
# (so that it can be traced directly).
- func: _dim_arange(Tensor like, int64_t dim) -> Tensor
# `argmin` and `argmax` are exposed in C++ but not in Python, where we only
# expose `_argmin` and `_argmax` (which call the first versions). In Python, we
# then define our own `argmax` and `argmin` that handle passing `dim=None`,
# which gets the argmax/argmin of the flattened array.
- func: argmax(Tensor self, int64_t dim, bool keepdim=false) -> Tensor
variants: function, method
- func: argmax(Tensor self) -> Tensor
variants: function, method
- func: _argmax(Tensor self, int64_t dim, bool keepdim=false) -> Tensor
variants: function
- func: argmin(Tensor self, int64_t dim, bool keepdim=false) -> Tensor
variants: function, method
- func: argmin(Tensor self) -> Tensor
variants: function, method
- func: _argmin(Tensor self, int64_t dim, bool keepdim=false) -> Tensor
variants: function
- func: as_strided(Tensor self, IntList size, IntList stride) -> Tensor
variants: function, method
device_guard: false
- func: as_strided_(Tensor self, IntList size, IntList stride) -> Tensor
variants: function, method
device_guard: false
- func: as_strided(Tensor self, IntList size, IntList stride, int64_t storage_offset) -> Tensor
variants: function, method
device_guard: false
python_default_init:
storage_offset: self.storage_offset()
- func: as_strided_(Tensor self, IntList size, IntList stride, int64_t storage_offset) -> Tensor
variants: function, method
device_guard: false
python_default_init:
storage_offset: self.storage_offset()
- func: asin(Tensor self) -> Tensor
variants: function, method
- func: asin_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _asin__cpu
CUDA: _asin__cuda
- func: asin_out(Tensor result, Tensor self) -> Tensor
dispatch:
CPU: _asin_out_cpu
CUDA: _asin_out_cuda
- func: atan(Tensor self) -> Tensor
variants: function, method
- func: atan_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _atan__cpu
CUDA: _atan__cuda
- func: atan_out(Tensor result, Tensor self) -> Tensor
dispatch:
CPU: _atan_out_cpu
CUDA: _atan_out_cuda
- func: baddbmm(Tensor self, Tensor batch1, Tensor batch2, *, Scalar beta=1, Scalar alpha=1) -> Tensor
variants: function, method
dispatch:
CPU: baddbmm_cpu
CUDA: baddbmm_cuda
- func: baddbmm_(Tensor self, Tensor batch1, Tensor batch2, *, Scalar beta=1, Scalar alpha=1) -> Tensor
variants: method
dispatch:
CPU: baddbmm__cpu
CUDA: baddbmm__cuda
- func: _baddbmm_mkl_(Tensor self, Tensor batch1, Tensor batch2, *, Scalar beta=1, Scalar alpha=1) -> Tensor
variants: function
- func: baddbmm_out(Tensor result, Tensor self, Tensor batch1, Tensor batch2, *, Scalar beta=1, Scalar alpha=1) -> Tensor
variants: function
dispatch:
CPU: baddbmm_out_cpu
CUDA: baddbmm_out_cuda
- func: bartlett_window(int64_t window_length, TensorOptions options={}) -> Tensor
- func: bartlett_window(int64_t window_length, bool periodic, TensorOptions options={}) -> Tensor
- func: batch_norm(Tensor input, Tensor? weight, Tensor? bias, Tensor? running_mean, Tensor? running_var, bool training, double momentum, double eps, bool cudnn_enabled) -> Tensor
# Sample bernoulli with values in `self` as probability.
- func: bernoulli(Tensor self, *, Generator* generator=nullptr) -> Tensor
variants: function, method
- func: bernoulli_out(Tensor result, Tensor self, *, Generator* generator=nullptr) -> Tensor
variants: function
- func: bernoulli_(Tensor self, Tensor p, *, Generator* generator=nullptr) -> Tensor
variants: method
dispatch:
CPU: bernoulli_tensor_cpu_
CUDA: bernoulli_tensor_cuda_
- func: bernoulli_(Tensor self, double p=0.5, *, Generator* generator=nullptr) -> Tensor
variants: method
dispatch:
CPU: bernoulli_scalar_cpu_
CUDA: bernoulli_scalar_cuda_
# This out-of-place version isn't used explicitly, but needed by jit.
# There is no default valid on `p` here because it would introduce ambiguity
# with `bernoulli(Tensor self, *, Generator* generator=nullptr)` declaration.
- func: bernoulli(Tensor self, double p, *, Generator* generator=nullptr) -> Tensor
variants: function, method
- func: bilinear(Tensor input1, Tensor input2, Tensor weight, Tensor? bias) -> Tensor
- func: binary_cross_entropy_with_logits(Tensor self, Tensor target, Tensor? weight, Tensor? pos_weight, int64_t reduction) -> Tensor
variants: function
- func: binary_cross_entropy_with_logits_backward(Tensor grad_output, Tensor self, Tensor target, Tensor? weight, Tensor? pos_weight, int64_t reduction) -> Tensor
variants: function
- func: bincount(Tensor self, Tensor? weights={}, int64_t minlength=0) -> Tensor
variants: function, method
dispatch:
CPU: _bincount_cpu
CUDA: _bincount_cuda
- func: blackman_window(int64_t window_length, TensorOptions options={}) -> Tensor
- func: blackman_window(int64_t window_length, bool periodic, TensorOptions options={}) -> Tensor
- func: bmm(Tensor self, Tensor mat2) -> Tensor
variants: function, method
dispatch:
CPU: bmm_cpu
CUDA: bmm_cuda
- func: bmm_out(Tensor result, Tensor self, Tensor mat2) -> Tensor
variants: function
dispatch:
CPU: bmm_out_cpu
CUDA: bmm_out_cuda
- func: broadcast_tensors(TensorList tensors) -> TensorList
device_guard: false
- func: cat(TensorList tensors, int64_t dim=0) -> Tensor
- func: cat_out(Tensor result, TensorList tensors, int64_t dim=0) -> Tensor
- func: ceil(Tensor self) -> Tensor
variants: function, method
- func: ceil_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _ceil__cpu
CUDA: _ceil__cuda
- func: ceil_out(Tensor result, Tensor self) -> Tensor
dispatch:
CPU: _ceil_out_cpu
CUDA: _ceil_out_cuda
- func: chain_matmul(TensorList matrices) -> Tensor
variants: function
- func: chunk(Tensor self, int64_t chunks, int64_t dim=0) -> TensorList
variants: function, method
device_guard: false
- func: clamp(Tensor self, Scalar? min=None, Scalar? max=None) -> Tensor
variants: function, method
- func: clamp_(Tensor self, Scalar? min=None, Scalar? max=None) -> Tensor
variants: function, method
dispatch:
CPU: _clamp__cpu
CUDA: _clamp__cuda
- func: clamp_out(Tensor result, Tensor self, Scalar? min=None, Scalar? max=None) -> Tensor
dispatch:
CPU: _clamp_out_cpu
CUDA: _clamp_out_cuda
- func: clamp_max(Tensor self, Scalar max) -> Tensor
variants: function, method
- func: clamp_max_(Tensor self, Scalar max) -> Tensor
variants: function, method
dispatch:
CPU: _clamp_max__cpu
CUDA: _clamp_max__cuda
- func: clamp_max_out(Tensor result, Tensor self, Scalar max) -> Tensor
dispatch:
CPU: _clamp_max_out_cpu
CUDA: _clamp_max_out_cuda
- func: clamp_min(Tensor self, Scalar min) -> Tensor
variants: function, method
- func: clamp_min_(Tensor self, Scalar min) -> Tensor
variants: function, method
dispatch:
CPU: _clamp_min__cpu
CUDA: _clamp_min__cuda
- func: clamp_min_out(Tensor result, Tensor self, Scalar min) -> Tensor
dispatch:
CPU: _clamp_min_out_cpu
CUDA: _clamp_min_out_cuda
- func: cudnn_is_acceptable(Tensor self) -> bool
device_guard: false
- func: constant_pad_nd(Tensor self, IntList pad, Scalar value=0) -> Tensor
variants: function
- func: contiguous(Tensor self) -> Tensor
variants: method
- func: convolution(Tensor input, Tensor weight, Tensor? bias, IntList stride, IntList padding, IntList dilation, bool transposed, IntList output_padding, int64_t groups) -> Tensor
- func: _convolution(Tensor input, Tensor weight, Tensor? bias, IntList stride, IntList padding, IntList dilation, bool transposed, IntList output_padding, int64_t groups, bool benchmark, bool deterministic, bool cudnn_enabled) -> Tensor
- func: _convolution_nogroup(Tensor input, Tensor weight, Tensor? bias, IntList stride, IntList padding, IntList dilation, bool transposed, IntList output_padding) -> Tensor
- func: _convolution_double_backward(Tensor? ggI, Tensor? ggW, Tensor? ggb, Tensor gO, Tensor weight, Tensor self, IntList stride, IntList padding, IntList dilation, bool transposed, IntList output_padding, int64_t groups, bool benchmark, bool deterministic, bool cudnn_enabled, std::array<bool,3> output_mask) -> (Tensor, Tensor, Tensor)
- func: conv1d(Tensor input, Tensor weight, Tensor bias={}, IntList[1] stride=1, IntList[1] padding=0, IntList[1] dilation=1, int64_t groups=1) -> Tensor
- func: conv2d(Tensor input, Tensor weight, Tensor bias={}, IntList[2] stride=1, IntList[2] padding=0, IntList[2] dilation=1, int64_t groups=1) -> Tensor
- func: conv3d(Tensor input, Tensor weight, Tensor bias={}, IntList[3] stride=1, IntList[3] padding=0, IntList[3] dilation=1, int64_t groups=1) -> Tensor
- func: conv_tbc(Tensor self, Tensor weight, Tensor bias, int64_t pad=0) -> Tensor
- func: conv_tbc_backward(Tensor self, Tensor input, Tensor weight, Tensor bias, int64_t pad) -> (Tensor, Tensor, Tensor)
# NB: we inherit the goofy argument order from PyTorch torch.nn.functional
- func: conv_transpose1d(Tensor input, Tensor weight, Tensor bias={}, IntList[1] stride=1, IntList[1] padding=0, IntList[1] output_padding=0, int64_t groups=1, IntList[1] dilation=1) -> Tensor
- func: conv_transpose2d(Tensor input, Tensor weight, Tensor bias={}, IntList[2] stride=1, IntList[2] padding=0, IntList[2] output_padding=0, int64_t groups=1, IntList[2] dilation=1) -> Tensor
- func: conv_transpose3d(Tensor input, Tensor weight, Tensor bias={}, IntList[3] stride=1, IntList[3] padding=0, IntList[3] output_padding=0, int64_t groups=1, IntList[3] dilation=1) -> Tensor
- func: cos(Tensor self) -> Tensor
variants: function, method
- func: cos_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _cos__cpu
CUDA: _cos__cuda
- func: cos_out(Tensor result, Tensor self) -> Tensor
dispatch:
CPU: _cos_out_cpu
CUDA: _cos_out_cuda
- func: cosh(Tensor self) -> Tensor
variants: function, method
- func: cosh_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _cosh__cpu
CUDA: _cosh__cuda
- func: cosh_out(Tensor result, Tensor self) -> Tensor
dispatch:
CPU: _cosh_out_cpu
CUDA: _cosh_out_cuda
- func: cosine_embedding_loss(Tensor input1, Tensor input2, Tensor target, double margin=0.0, int64_t reduction=Reduction::Mean) -> Tensor
- func: cudnn_affine_grid_generator(Tensor theta, int64_t N, int64_t C, int64_t H, int64_t W) -> Tensor
return:
- type: Tensor
name: grid
dispatch:
CUDA: cudnn_affine_grid_generator_forward
# TODO: Why do I have to call this grad?!
- func: cudnn_affine_grid_generator_backward(Tensor grad, int64_t N, int64_t C, int64_t H, int64_t W)
return:
- type: Tensor
name: grad_theta
dispatch:
CUDA: cudnn_affine_grid_generator_backward
- func: cudnn_batch_norm(Tensor input, Tensor weight, Tensor? bias, Tensor? running_mean, Tensor? running_var, bool training, double exponential_average_factor, double epsilon) -> (Tensor, Tensor, Tensor)
dispatch:
CUDA: cudnn_batch_norm
# NB: You can only use this if you used cudnn_batch_norm training=True
- func: cudnn_batch_norm_backward(Tensor input, Tensor grad_output, Tensor weight, Tensor? running_mean, Tensor? running_var, Tensor? save_mean, Tensor? save_var, double epsilon) -> (Tensor, Tensor, Tensor)
dispatch:
CUDA: cudnn_batch_norm_backward
- func: cudnn_convolution(Tensor self, Tensor weight, Tensor? bias, IntList padding, IntList stride, IntList dilation, int64_t groups, bool benchmark, bool deterministic) -> Tensor
dispatch:
CUDA: cudnn_convolution
- func: cudnn_convolution_backward_input(IntList self_size, Tensor grad_output, Tensor weight, IntList padding, IntList stride, IntList dilation, int64_t groups, bool benchmark, bool deterministic) -> Tensor
dispatch:
CUDA: cudnn_convolution_backward_input
- func: cudnn_convolution_backward(Tensor self, Tensor grad_output, Tensor weight, IntList padding, IntList stride, IntList dilation, int64_t groups, bool benchmark, bool deterministic, std::array<bool,3> output_mask) -> (Tensor, Tensor, Tensor)
dispatch:
CUDA: cudnn_convolution_backward
- func: cudnn_convolution_backward_bias(Tensor grad_output) -> Tensor
dispatch:
CUDA: cudnn_convolution_backward_bias
- func: cudnn_convolution_backward_weight(IntList weight_size, Tensor grad_output, Tensor self, IntList padding, IntList stride, IntList dilation, int64_t groups, bool benchmark, bool deterministic) -> Tensor
dispatch:
CUDA: cudnn_convolution_backward_weight
- func: cudnn_convolution_transpose(Tensor self, Tensor weight, Tensor? bias, IntList padding, IntList output_padding, IntList stride, IntList dilation, int64_t groups, bool benchmark, bool deterministic) -> Tensor
dispatch:
CUDA: cudnn_convolution_transpose
# NB: output_padding not strictly needed here, but it's helpful for the double
# backwards
- func: cudnn_convolution_transpose_backward(Tensor self, Tensor grad_output, Tensor weight, IntList padding, IntList output_padding, IntList stride, IntList dilation, int64_t groups, bool benchmark, bool deterministic, std::array<bool,3> output_mask) -> (Tensor, Tensor, Tensor)
dispatch:
CUDA: cudnn_convolution_transpose_backward
- func: cudnn_convolution_transpose_backward_bias(Tensor grad_output) -> Tensor
dispatch:
CUDA: cudnn_convolution_backward_bias
- func: cudnn_convolution_transpose_backward_input(Tensor grad_output, Tensor weight, IntList padding, IntList stride, IntList dilation, int64_t groups, bool benchmark, bool deterministic) -> Tensor
dispatch:
CUDA: cudnn_convolution_transpose_backward_input
- func: cudnn_convolution_transpose_backward_weight(IntList weight_size, Tensor grad_output, Tensor self, IntList padding, IntList stride, IntList dilation, int64_t groups, bool benchmark, bool deterministic) -> Tensor
dispatch:
CUDA: cudnn_convolution_transpose_backward_weight
# NB: input is special cased in a way I don't quite understand
- func: cudnn_grid_sampler(Tensor self, Tensor grid)
return:
- type: Tensor
name: output
dispatch:
CUDA: cudnn_grid_sampler_forward
- func: cudnn_grid_sampler_backward(Tensor self, Tensor grid, Tensor grad_output)
return:
- type: Tensor
name: grad_self
- type: Tensor
name: grad_grid
dispatch:
CUDA: cudnn_grid_sampler_backward
# FIXME: These could be combined as optional<ScalarType> but for https://github.com/pytorch/pytorch/issues/6593.
- func: cumsum(Tensor self, int64_t dim, *, ScalarType dtype) -> Tensor
variants: function, method
- func: cumsum(Tensor self, int64_t dim) -> Tensor
variants: function, method
- func: cumsum_out(Tensor result, Tensor self, int64_t dim, *, ScalarType dtype) -> Tensor
- func: cumsum_out(Tensor result, Tensor self, int64_t dim) -> Tensor
# FIXME: These could be combined as optional<ScalarType> but for https://github.com/pytorch/pytorch/issues/6593.
- func: cumprod(Tensor self, int64_t dim, *, ScalarType dtype) -> Tensor
variants: function, method
- func: cumprod(Tensor self, int64_t dim) -> Tensor
variants: function, method
- func: cumprod_out(Tensor result, Tensor self, int64_t dim, *, ScalarType dtype) -> Tensor
- func: cumprod_out(Tensor result, Tensor self, int64_t dim) -> Tensor
- func: ctc_loss(Tensor log_probs, Tensor targets, IntList input_lengths, IntList target_lengths, int64_t blank=0, int64_t reduction=Reduction::Mean) -> Tensor
# convenience function that converts to intlists for you
- func: ctc_loss(Tensor log_probs, Tensor targets, Tensor input_lengths, Tensor target_lengths, int64_t blank=0, int64_t reduction=Reduction::Mean) -> Tensor
- func: _ctc_loss(Tensor log_probs, Tensor targets, IntList input_lengths, IntList target_lengths, int64_t blank=0) -> (Tensor, Tensor)
dispatch:
CPU: ctc_loss_cpu
CUDA: ctc_loss_gpu
- func: _ctc_loss_backward(Tensor grad, Tensor log_probs, Tensor targets, IntList input_lengths, IntList target_lengths, Tensor neg_log_likelihood, Tensor log_alpha, int64_t blank) -> Tensor
dispatch:
CPU: ctc_loss_backward_cpu
CUDA: ctc_loss_backward_gpu
- func: det(Tensor self) -> Tensor
variants: function, method
- func: diagflat(Tensor self, int64_t offset=0) -> Tensor
variants: function, method
- func: diagonal(Tensor self, int64_t offset=0, int64_t dim1=0, int64_t dim2=1) -> Tensor
variants: function, method
- func: div(Tensor self, Tensor other) -> Tensor
variants: function, method
- func: div_(Tensor self, Tensor other) -> Tensor
variants: method
- func: div_out(Tensor result, Tensor self, Tensor other) -> Tensor
# For C++ only, until we have conversion from C++ numbers to Tensor
- func: div(Tensor self, Scalar other) -> Tensor
variants: function, method
- func: div_(Tensor self, Scalar other) -> Tensor
variants: method
- func: dot(Tensor self, Tensor tensor) -> Tensor
variants: function, method
- func: dot_out(Tensor result, Tensor self, Tensor tensor) -> Tensor
- func: einsum(std::string equation, TensorList tensors) -> Tensor
- func: embedding(Tensor weight, IndexTensor indices, int64_t padding_idx=-1, bool scale_grad_by_freq=false, bool sparse=false) -> Tensor
- func: embedding_backward(Tensor grad, IndexTensor indices, int64_t num_weights, int64_t padding_idx, bool scale_grad_by_freq, bool sparse) -> Tensor
- func: embedding_dense_backward(Tensor grad, IndexTensor indices, int64_t num_weights, int64_t padding_idx, bool scale_grad_by_freq) -> Tensor
dispatch:
CPU: embedding_dense_backward_cpu
CUDA: embedding_dense_backward_cuda
- func: embedding_renorm_(Tensor self, IndexTensor indices, double max_norm, double norm_type) -> Tensor
dispatch:
CPU: embedding_renorm_cpu_
CUDA: embedding_renorm_cuda_
- func: embedding_sparse_backward(Tensor grad, IndexTensor indices, int64_t num_weights, int64_t padding_idx, bool scale_grad_by_freq) -> Tensor
# NOTE [ embedding_bag Native Functions ]
# The `_embedding_bag.*` variants assume that input tensors except for `weight`,
# e.g. `indices` and `offsets` (and `offset2bag`), are contiguous.
# We really only need to enforce this for `_embedding_bag` (the forward) because
# the backward inputs are the same as forward ones.
# The above `embedding_bag` wrapper is created to achieve this, e.g.,
# applying indices = indices.contiguous().
# The backward functions apply a check that these input tensors are contiguous.
- func: embedding_bag(Tensor weight, IndexTensor indices, IndexTensor offsets, bool scale_grad_by_freq=false, int64_t mode=0, bool sparse=false) -> (Tensor, Tensor, Tensor, Tensor)
- func: _embedding_bag(Tensor weight, IndexTensor indices, IndexTensor offsets, bool scale_grad_by_freq=false, int64_t mode=0, bool sparse=false) -> (Tensor, Tensor, Tensor, Tensor)
dispatch:
CPU: _embedding_bag_cpu
CUDA: _embedding_bag_cuda
- func: _embedding_bag_backward(Tensor grad, IndexTensor indices, IndexTensor offsets, IndexTensor offset2bag, IndexTensor bag_size, IndexTensor maximum_indices, int64_t num_weights, bool scale_grad_by_freq, int64_t mode, bool sparse) -> Tensor
- func: _embedding_bag_sparse_backward(Tensor grad, IndexTensor indices, IndexTensor offsets, IndexTensor offset2bag, IndexTensor bag_size, int64_t num_weights, bool scale_grad_by_freq, int64_t mode) -> Tensor
- func: _embedding_bag_dense_backward(Tensor grad, IndexTensor indices, IndexTensor offsets, IndexTensor offset2bag, IndexTensor bag_size, IndexTensor maximum_indices, int64_t num_weights, bool scale_grad_by_freq, int64_t mode) -> Tensor
dispatch:
CPU: _embedding_bag_dense_backward_cpu
CUDA: _embedding_bag_dense_backward_cuda
- func: empty(IntList size, TensorOptions options={}) -> Tensor
cpu_half: True
dispatch:
CPU: empty_cpu
CUDA: empty_cuda
SparseCPU: empty_sparse
SparseCUDA: empty_sparse
- func: resize_(Tensor self, IntList size) -> Tensor
variants: method
cpu_half: True
device_guard: False
dispatch:
CPU: resize_cpu_
CUDA: resize_cuda_
- func: empty_out(Tensor result, IntList size) -> Tensor
- func: empty_like(Tensor self) -> Tensor
- func: empty_like(Tensor self, *, TensorOptions options) -> Tensor
- func: empty_strided(IntList size, IntList stride, *, TensorOptions options={}) -> Tensor
- func: erf(Tensor self) -> Tensor
variants: function, method
- func: erf_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _erf__cpu
CUDA: _erf__cuda
- func: erf_out(Tensor result, Tensor self) -> Tensor
dispatch:
CPU: _erf_out_cpu
CUDA: _erf_out_cuda
- func: erfc(Tensor self) -> Tensor
variants: function, method
- func: erfc_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _erfc__cpu
CUDA: _erfc__cuda
- func: erfc_out(Tensor result, Tensor self) -> Tensor
dispatch:
CPU: _erfc_out_cpu
CUDA: _erfc_out_cuda
- func: exp(Tensor self) -> Tensor
variants: function, method
- func: exp_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _exp__cpu
CUDA: _exp__cuda
- func: exp_out(Tensor result, Tensor self) -> Tensor
dispatch:
CPU: _exp_out_cpu
CUDA: _exp_out_cuda
- func: expm1(Tensor self) -> Tensor
variants: function, method
- func: expm1_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _expm1__cpu
CUDA: _expm1__cuda
- func: expm1_out(Tensor result, Tensor self) -> Tensor
dispatch:
CPU: _expm1_out_cpu
CUDA: _expm1_out_cuda
- func: expand(Tensor self, IntList size, *, bool implicit=false) -> Tensor
variants: method # This is method-only to match the previous tensor API. In the future we could make this a function too.
device_guard: false
- func: expand_as(Tensor self, Tensor other) -> Tensor
variants: method # This is method-only to match the previous tensor API. In the future we could make this a function too.
device_guard: false
- func: eye(int64_t n, TensorOptions options={}) -> Tensor
- func: eye(int64_t n, int64_t m, TensorOptions options={}) -> Tensor
- func: eye_out(Tensor result, int64_t n) -> Tensor
dispatch:
CPU: eye_out_cpu
CUDA: eye_out_cuda
- func: eye_out(Tensor result, int64_t n, int64_t m) -> Tensor
dispatch:
CPU: eye_out_cpu
CUDA: eye_out_cuda
- func: flatten(Tensor self, int64_t start_dim=0, int64_t end_dim=-1) -> Tensor
variants: function, method
- func: fill_(Tensor self, Scalar value) -> Tensor
variants: function, method
- func: fill_(Tensor self, Tensor value) -> Tensor
variants: function, method
- func: floor(Tensor self) -> Tensor
variants: function, method
- func: floor_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _floor__cpu
CUDA: _floor__cuda
- func: floor_out(Tensor result, Tensor self) -> Tensor
dispatch:
CPU: _floor_out_cpu
CUDA: _floor_out_cuda
- func: full(IntList size, Scalar fill_value, TensorOptions options={}) -> Tensor
- func: full_out(Tensor result, IntList size, Scalar fill_value) -> Tensor
- func: full_like(Tensor self, Scalar fill_value) -> Tensor
- func: full_like(Tensor self, Scalar fill_value, *, TensorOptions options) -> Tensor
# NOTE [ grid_sampler Native Functions ]
# `grid_sampler` does all the shape checking and then dispatches to one of
# `cudnn_grid_sampler`, `grid_sampler_2d`, or `grid_sampler_3d`, each of which
# has the corresponding backward defined as native functions as well. Therefore,
# in these functions and their backwards, no more shape checking is done.
#
# Additionally, arguments `padding_mode` and `interpolation_mode` are cast to
# enums defined in `native/GridSampler.h`. `cudnn_grid_sampler` doesn't take in
# `interpolation_mode` because it only supports Bilinear interpolation mode.
- func: grid_sampler(Tensor input, Tensor grid, int64_t interpolation_mode, int64_t padding_mode) -> Tensor
- func: grid_sampler_2d(Tensor input, Tensor grid, int64_t interpolation_mode, int64_t padding_mode) -> Tensor
dispatch:
CPU: grid_sampler_2d_cpu
CUDA: grid_sampler_2d_cuda
- func: grid_sampler_2d_backward(Tensor grad_output, Tensor input, Tensor grid, int64_t interpolation_mode, int64_t padding_mode) -> (Tensor, Tensor)
dispatch:
CPU: grid_sampler_2d_backward_cpu
CUDA: grid_sampler_2d_backward_cuda
- func: grid_sampler_3d(Tensor input, Tensor grid, int64_t interpolation_mode, int64_t padding_mode) -> Tensor
dispatch:
CPU: grid_sampler_3d_cpu
CUDA: grid_sampler_3d_cuda
- func: grid_sampler_3d_backward(Tensor grad_output, Tensor input, Tensor grid, int64_t interpolation_mode, int64_t padding_mode) -> (Tensor, Tensor)
dispatch:
CPU: grid_sampler_3d_backward_cpu
CUDA: grid_sampler_3d_backward_cuda
- func: hann_window(int64_t window_length, TensorOptions options={}) -> Tensor
- func: hann_window(int64_t window_length, bool periodic, TensorOptions options={}) -> Tensor
- func: hamming_window(int64_t window_length, TensorOptions options={}) -> Tensor
- func: hamming_window(int64_t window_length, bool periodic, TensorOptions options={}) -> Tensor
- func: hamming_window(int64_t window_length, bool periodic, double alpha, TensorOptions options={}) -> Tensor
- func: hamming_window(int64_t window_length, bool periodic, double alpha, double beta, TensorOptions options={}) -> Tensor
- func: hinge_embedding_loss(Tensor self, Tensor target, double margin=1.0, int64_t reduction=Reduction::Mean) -> Tensor
- func: ger(Tensor self, Tensor vec2) -> Tensor
variants: function, method
- func: ger_out(Tensor result, Tensor self, Tensor vec2) -> Tensor
- func: gesv(Tensor self, Tensor A) -> (Tensor, Tensor)
variants: function, method
- func: gesv_out(Tensor solution, Tensor lu, Tensor self, Tensor A) -> (Tensor, Tensor)
# gesv handles broadcasting of arbitrary batch dims while _gesv_helper does not.
- func: _gesv_helper(Tensor self, Tensor A) -> (Tensor, Tensor)
variants: function
dispatch:
CPU: _gesv_helper_cpu
CUDA: _gesv_helper_cuda
- func: group_norm(Tensor input, int64_t num_groups, Tensor? weight={}, Tensor? bias={}, double eps=1e-5, bool cudnn_enabled=True) -> Tensor
# FFT
- func: fft(Tensor self, int64_t signal_ndim, bool normalized=false) -> Tensor
variants: function, method
- func: ifft(Tensor self, int64_t signal_ndim, bool normalized=false) -> Tensor
variants: function, method
- func: rfft(Tensor self, int64_t signal_ndim, bool normalized=false, bool onesided=true) -> Tensor
variants: function, method
- func: irfft(Tensor self, int64_t signal_ndim, bool normalized=false, bool onesided=true, IntList signal_sizes={}) -> Tensor
variants: function, method
- func: _fft_with_size(Tensor self, int64_t signal_ndim, bool complex_input, bool complex_output, bool inverse, IntList checked_signal_sizes, bool normalized, bool onesided, IntList output_sizes) -> Tensor
variants: function
dispatch:
CPU: _fft_mkl
CUDA: _fft_cufft
- func: _cufft_get_plan_cache_size() -> int64_t
device_guard: false
- func: _cufft_get_plan_cache_max_size() -> int64_t
device_guard: false
- func: _cufft_set_plan_cache_max_size(int64_t max_size)
device_guard: false
- func: _cufft_clear_plan_cache()
device_guard: false
- func: index(Tensor self, TensorList indices) -> Tensor
variants: function, method
# NB: This function is special-cased in tools/autograd/gen_variable_type.py
- func: index_copy_(Tensor self, int64_t dim, IndexTensor index, Tensor source) -> Tensor
variants: method
- func: index_put(Tensor self, TensorList indices, Tensor values) -> Tensor
variants: function, method
- func: index_put_(Tensor self, TensorList indices, Tensor values) -> Tensor
variants: function, method
- func: instance_norm(Tensor input, Tensor? weight, Tensor? bias, Tensor? running_mean, Tensor? running_var, bool use_input_stats, double momentum, double eps, bool cudnn_enabled) -> Tensor
variants: function
- func: inverse(Tensor self) -> Tensor
variants: function, method
- func: inverse_out(Tensor result, Tensor self) -> Tensor
- func: _inverse_helper(Tensor self) -> Tensor
dispatch:
CPU: _inverse_helper_cpu
CUDA: _inverse_helper_cuda
- func: isclose(Tensor self, Tensor other, double rtol=1e-5, double atol=1e-8, bool equal_nan=False) -> Tensor
variants: function, method
- func: is_distributed(Tensor self) -> bool
variants: function, method
device_guard: false
- func: is_floating_point(Tensor self) -> bool
variants: function, method
device_guard: false
- func: is_complex(Tensor self) -> bool
variants: function, method
device_guard: false
- func: is_nonzero(Tensor self) -> bool
variants: function, method
device_guard: false
- func: is_same_size(Tensor self, Tensor other) -> bool
variants: function, method
device_guard: false
- func: is_signed(Tensor self) -> bool
variants: function, method
device_guard: false
- func: kl_div(Tensor self, Tensor target, int64_t reduction=Reduction::Mean) -> Tensor
- func: kl_div_backward(Tensor grad_output, Tensor self, Tensor target, int64_t reduction=Reduction::Mean) -> Tensor
dispatch:
CPU: kl_div_backward_cpu
CUDA: kl_div_backward_cuda
- func: kthvalue(Tensor self, int64_t k, int64_t dim=-1, bool keepdim=false) -> (Tensor, Tensor)
variants: function, method
- func: kthvalue_out(Tensor values, Tensor indices, Tensor self, int64_t k, int64_t dim=-1, bool keepdim=false) -> (Tensor, Tensor)
- func: layer_norm(Tensor input, IntList normalized_shape, Tensor? weight={}, Tensor? bias={}, double eps=1e-5, bool cudnn_enable=True) -> Tensor
- func: linear(Tensor input, Tensor weight, Tensor bias={}) -> Tensor
- func: linspace(Scalar start, Scalar end, TensorOptions options={}) -> Tensor
- func: linspace(Scalar start, Scalar end, int64_t steps, TensorOptions options={}) -> Tensor
- func: linspace_out(Tensor result, Scalar start, Scalar end) -> Tensor
- func: linspace_out(Tensor result, Scalar start, Scalar end, int64_t steps) -> Tensor
- func: log(Tensor self) -> Tensor
variants: function, method
- func: log_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _log__cpu
CUDA: _log__cuda
- func: log_out(Tensor result, Tensor self) -> Tensor
dispatch:
CPU: _log_out_cpu
CUDA: _log_out_cuda
- func: log10(Tensor self) -> Tensor
variants: function, method
- func: log10_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _log10__cpu
CUDA: _log10__cuda
- func: log10_out(Tensor result, Tensor self) -> Tensor
dispatch:
CPU: _log10_out_cpu
CUDA: _log10_out_cuda
- func: log1p(Tensor self) -> Tensor
variants: function, method
- func: log1p_(Tensor self) -> Tensor
variants: function, method
dispatch:
CPU: _log1p__cpu
CUDA: _log1p__cuda
SparseCPU: log1p_sparse_