/
native_functions.yaml
15424 lines (12822 loc) · 565 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
# *********NB: _cast_* operators are DEPRECATED and will be removed
# eventually. These were previously used before TorchScript IR supported
# representing ScalarType's. They are now superseded by usage of
# `aten::to()`. The ops remain here for backward compatibility purposes.
# DEPRECATED. DO NOT USE
- func: _cast_Byte(Tensor self, bool non_blocking=False) -> Tensor
variants: function
# DEPRECATED. DO NOT USE
- func: _cast_Char(Tensor self, bool non_blocking=False) -> Tensor
variants: function
# DEPRECATED. DO NOT USE
- func: _cast_Double(Tensor self, bool non_blocking=False) -> Tensor
variants: function
# DEPRECATED. DO NOT USE
- func: _cast_Float(Tensor self, bool non_blocking=False) -> Tensor
variants: function
# DEPRECATED. DO NOT USE
- func: _cast_Int(Tensor self, bool non_blocking=False) -> Tensor
variants: function
# DEPRECATED. DO NOT USE
- func: _cast_Long(Tensor self, bool non_blocking=False) -> Tensor
variants: function
# DEPRECATED. DO NOT USE
- func: _cast_Short(Tensor self, bool non_blocking=False) -> Tensor
variants: function
# DEPRECATED. DO NOT USE
- func: _cast_Half(Tensor self, bool non_blocking=False) -> Tensor
variants: function
# Computes the gradient of current tensor w.r.t. graph leaves.
- func: _backward(Tensor self, Tensor[] inputs, Tensor? gradient=None, bool? retain_graph=None, bool create_graph=False) -> ()
manual_cpp_binding: True
variants: method
# DEPRECATED. Sets the tensor data held by this `Variable` to be the same as
# `new_data`. It requires that `new_data` and `Variable` have compatible tensor
# type, by checking `_has_compatible_shallow_copy_type(this, new_data)`.
#
# This function is deprecated because it doesn't really make sense in a world
# where Variables *are* Tensors (as opposed to them containing tensors, which
# is what the previous interpretation was.)
- func: set_data(Tensor(a!) self, Tensor new_data) -> ()
manual_cpp_binding: True
variants: method
- func: data(Tensor self) -> Tensor
manual_cpp_binding: True
variants: method
# True if this `Variable` is a leaf and thus does not have a `grad_fn`.
- func: is_leaf(Tensor self) -> bool
manual_cpp_binding: True
variants: method
# Returns the output index of this variable from the forward operation that
# produced it. Conversely, it returns the input index of the gradient `Node` to
# which this `Variable` is connected (because in the gradient computation,
# inputs and outputs switch meaning). For example:
#
# y0, y1, y2 = f(x)
# assert y0.output_nr == 0
# assert y1.output_nr == 1
# assert y2.output_nr == 2
#
- func: output_nr(Tensor self) -> int
manual_cpp_binding: True
variants: method
- func: _version(Tensor self) -> int
manual_cpp_binding: True
variants: method
- func: requires_grad_(Tensor(a!) self, bool requires_grad=True) -> Tensor(a!)
manual_cpp_binding: True
variants: method
# Enables .grad attribute for non-leaf Tensors.
- func: retain_grad(Tensor(a!) self) -> ()
manual_cpp_binding: True
variants: method
- func: retains_grad(Tensor self) -> bool
manual_cpp_binding: True
variants: method
- func: _fw_primal(Tensor(a) self, int level) -> Tensor(a)
variants: method
dispatch:
CompositeExplicitAutograd: _fw_primal
- func: _make_dual(Tensor(a) primal, Tensor tangent, int level) -> Tensor(a)
variants: function
dispatch:
CompositeExplicitAutograd: _make_dual
- func: _unpack_dual(Tensor(a) dual, int level) -> (Tensor(a) primal, Tensor tangent)
variants: function
# NOTE: [_new_zeros_with_same_feature_meta]
# This function creates a new tensor with the layout and TensorOptions
# of `other` but also takes into account the batch dimensions of `self`
#
# This function has a couple extra constraints because it is also used for `jvp`
# in functorch.
# - is used for forward AD because there is the restriction
# that the primal and tangent must have the same layout
# - We cannot assume that `self` and `other` have the same sizes or even dim
# because in the inplace over view case, `other` is the base tensor, and
# `self` is the forward grad with respect to the view, which can have an
# entirely different shape
# - takes the number of batch dims for `self` because we also handle
# some batching logic. We handle that here instead of a batching rule because
# we'd like to avoid calling as_strided in the batching rule (as to enable
# nested vmap in functorch).
# - needs to be CompositeExplicitAutograd for jvp support in functorch.
# functorch currently relies on TensorWrapper which does not have storage
# CompositeExplicitAutograd makes sure the TensorWrapper is unwrapped.
# - this function may eventually take on another int argument to store the
# the number of batch dims for other once we support that use case
- func: _new_zeros_with_same_feature_meta(Tensor self, Tensor other, *, int self_num_batch_dims=0) -> Tensor
variants: function
dispatch:
CompositeExplicitAutograd: _new_zeros_with_same_feature_meta
autogen: _new_zeros_with_same_feature_meta.out
# This function compares the storage numel of self with that of other, where
# storage numel is cumputed as: `other.storage().nbytes() / other.itemsize()`.
# We create this function for composite compliance purposes. The batching rule
# always returns true because vmapped as_strided does not support accessing
# storage locations not indexable by the input tensor.
# See the note above for more information.
- func: _has_same_storage_numel(Tensor self, Tensor other) -> bool
variants: function
dispatch:
CompositeExplicitAutograd: _has_same_storage_numel
- func: rename_(Tensor(a!) self, Dimname[]? names) -> Tensor(a!)
variants: method
tags: inplace_view
- func: rename(Tensor(a) self, Dimname[]? names) -> Tensor(a)
variants: method
- func: align_to(Tensor(a) self, Dimname[] names) -> Tensor(a)
variants: method
- func: align_to.ellipsis_idx(Tensor(a) self, Dimname[] order, int ellipsis_idx) -> Tensor(a)
variants: method
- func: align_as(Tensor self, Tensor other) -> Tensor
variants: method
- func: align_tensors(Tensor[] tensors) -> Tensor[]
# Not assert because it's a keyword; not Assert because FX already
# took that syntax
# TODO: need to specify this is side-effectful somehow
- func: _assert_async(Tensor self) -> ()
dispatch:
CPU: _assert_async_cpu
CUDA: _assert_async_cuda
- func: _assert_async.msg(Tensor self, str assert_msg) -> ()
dispatch:
CPU: _assert_async_msg_cpu
CUDA: _assert_async_msg_cuda
- func: _assert_scalar(Scalar self, str assert_msg) -> ()
dispatch:
CompositeExplicitAutograd: _assert_scalar
- func: _functional_assert_scalar(Scalar self, str assert_msg, Tensor dep_token) -> Tensor
dispatch:
CompositeExplicitAutograd: _functional_assert_scalar
- func: _functional_assert_async.msg(Tensor self, str assert_msg, Tensor dep_token) -> Tensor
dispatch:
CPU: _functional_assert_async_msg_cpu
- func: _assert_tensor_metadata(Tensor a, SymInt[]? size=None, SymInt[]? stride=None, ScalarType? dtype=None) -> ()
- func: sym_constrain_range(Scalar size, *, int? min=None, int? max=None) -> ()
dispatch:
CompositeExplicitAutograd: sym_constrain_range
- func: sym_constrain_range_for_size(Scalar size, *, int? min=None, int? max=None) -> ()
dispatch:
CompositeExplicitAutograd: sym_constrain_range_for_size
- func: _functional_sym_constrain_range(Scalar size, int? min, int? max, Tensor dep_token) -> Tensor
dispatch:
CompositeExplicitAutograd: _functional_sym_constrain_range
- func: _functional_sym_constrain_range_for_size(Scalar size, int? min, int? max, Tensor dep_token) -> Tensor
dispatch:
CompositeExplicitAutograd: _functional_sym_constrain_range_for_size
- func: _make_dep_token(*, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None, MemoryFormat? memory_format=None) -> Tensor
dispatch:
CPU: _make_dep_token_cpu
- func: refine_names(Tensor(a) self, Dimname[] names) -> Tensor(a)
variants: method
- func: _use_cudnn_ctc_loss(Tensor log_probs, Tensor targets, int[] input_lengths, int[] target_lengths, int blank) -> bool
device_check: NoCheck # Tensor arguments allowed to be on different devices, see also _cudnn_ctc_loss
dispatch:
CUDA: _use_cudnn_ctc_loss
- func: _use_cudnn_ctc_loss.Tensor(Tensor log_probs, Tensor targets, Tensor input_lengths, Tensor target_lengths, int blank) -> bool
device_check: NoCheck # Tensor arguments allowed to be on different devices, see also _cudnn_ctc_loss
dispatch:
CUDA: _use_cudnn_ctc_loss_tensor
- func: _cudnn_ctc_loss(Tensor log_probs, Tensor targets, int[] input_lengths, int[] target_lengths, int blank, bool deterministic, bool zero_infinity) -> (Tensor, Tensor)
device_check: NoCheck # log_probs is expected to be on CUDA while targets is expected to be on CPU
dispatch:
CUDA: _cudnn_ctc_loss
autogen: _cudnn_ctc_loss.out
- func: _cudnn_ctc_loss.Tensor(Tensor log_probs, Tensor targets, Tensor input_lengths, Tensor target_lengths, int blank, bool deterministic, bool zero_infinity) -> (Tensor, Tensor)
device_check: NoCheck # log_probs is expected to be on CUDA while targets is expected to be on CPU
dispatch:
CUDA: _cudnn_ctc_loss_tensor
- func: _use_cudnn_rnn_flatten_weight() -> bool
- func: _cudnn_rnn_flatten_weight(Tensor[] weight_arr, int weight_stride0, SymInt input_size, int mode, SymInt hidden_size, SymInt proj_size, int num_layers, bool batch_first, bool bidirectional) -> Tensor
dispatch:
CUDA: _cudnn_rnn_flatten_weight
autogen: _cudnn_rnn_flatten_weight.out
- func: _cudnn_rnn(Tensor input, Tensor[] weight, int weight_stride0, Tensor? weight_buf, Tensor hx, Tensor? cx, int mode, SymInt hidden_size, SymInt proj_size, int num_layers, bool batch_first, float dropout, bool train, bool bidirectional, SymInt[] batch_sizes, Tensor? dropout_state) -> (Tensor, Tensor, Tensor, Tensor, Tensor)
# rnn_tanh may or may not redispatch to _cudnn_rnn based on algorithm and build. Thus it might hit dispatch or kernel device check.
# Disable dispatch time device check for consistent behavior.
device_check: NoCheck
dispatch:
CUDA: _cudnn_rnn
autogen: _cudnn_rnn.out
tags: nondeterministic_seeded
- func: _cudnn_rnn_backward(Tensor input, Tensor[] weight, int weight_stride0, Tensor weight_buf, Tensor hx, Tensor? cx, Tensor output, Tensor? grad_output, Tensor? grad_hy, Tensor? grad_cy, int mode, SymInt hidden_size, SymInt proj_size, int num_layers, bool batch_first, float dropout, bool train, bool bidirectional, SymInt[] batch_sizes, Tensor? dropout_state, Tensor reserve, bool[4] output_mask) -> (Tensor, Tensor, Tensor, Tensor[])
dispatch:
CUDA: _cudnn_rnn_backward
autogen: _cudnn_rnn_backward.out
- func: _cudnn_init_dropout_state(float dropout, bool train, int dropout_seed, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=False) -> Tensor
dispatch:
CUDA: _cudnn_init_dropout_state
autogen: _cudnn_init_dropout_state.out
tags: nondeterministic_seeded
- func: _debug_has_internal_overlap(Tensor self) -> int
variants: function
- func: _fused_dropout(Tensor self, float p, Generator? generator=None) -> (Tensor, Tensor)
variants: function
dispatch:
CUDA: fused_dropout_cuda
tags: nondeterministic_seeded
autogen: _fused_dropout.out
- func: _masked_scale(Tensor self, Tensor mask, float scale) -> Tensor
variants: function
dispatch:
CUDA: masked_scale_cuda
autogen: _masked_scale.out
- func: native_dropout(Tensor input, float p, bool? train) -> (Tensor, Tensor)
variants: function
dispatch:
CPU: native_dropout_cpu
CUDA: native_dropout_cuda
NestedTensorCPU, NestedTensorCUDA: native_dropout_nested
tags: [nondeterministic_seeded, core]
autogen: native_dropout.out
- func: native_dropout_backward(Tensor grad_output, Tensor mask, float scale) -> Tensor
dispatch:
CPU, NestedTensorCPU, NestedTensorCUDA: native_dropout_backward
CUDA: native_dropout_backward_cuda
autogen: native_dropout_backward.out
tags: pointwise
- func: _sobol_engine_draw(Tensor quasi, int n, Tensor sobolstate, int dimension, int num_generated, ScalarType? dtype) -> (Tensor, Tensor)
- func: _sobol_engine_ff_(Tensor(a!) self, int n, Tensor sobolstate, int dimension, int num_generated) -> Tensor(a!)
- func: _sobol_engine_scramble_(Tensor(a!) self, Tensor ltm, int dimension) -> Tensor(a!)
- func: _sobol_engine_initialize_state_(Tensor(a!) self, int dimension) -> Tensor(a!)
- func: _reshape_from_tensor(Tensor self, Tensor shape) -> Tensor
- func: _shape_as_tensor(Tensor self) -> Tensor
- func: dropout(Tensor input, float p, bool train) -> Tensor
tags: nondeterministic_seeded
- func: dropout_(Tensor(a!) self, float p, bool train) -> Tensor(a!)
tags: nondeterministic_seeded
- func: feature_dropout(Tensor input, float p, bool train) -> Tensor
tags: nondeterministic_seeded
- func: feature_dropout_(Tensor(a!) self, float p, bool train) -> Tensor(a!)
tags: nondeterministic_seeded
- func: alpha_dropout(Tensor input, float p, bool train) -> Tensor
tags: nondeterministic_seeded
- func: alpha_dropout_(Tensor(a!) self, float p, bool train) -> Tensor(a!)
tags: nondeterministic_seeded
- func: feature_alpha_dropout(Tensor input, float p, bool train) -> Tensor
tags: nondeterministic_seeded
- func: feature_alpha_dropout_(Tensor(a!) self, float p, bool train) -> Tensor(a!)
tags: nondeterministic_seeded
- func: abs(Tensor self) -> Tensor
device_check: NoCheck # TensorIterator
variants: function, method
dispatch:
CompositeExplicitAutograd: abs
SparseCPU, SparseCUDA: abs_sparse
SparseCsrCPU, SparseCsrCUDA: abs_sparse_csr
NestedTensorCPU, NestedTensorCUDA: NestedTensor_abs
tags: [core, pointwise]
- func: abs_(Tensor(a!) self) -> Tensor(a!)
device_check: NoCheck # TensorIterator
variants: function, method
dispatch:
CompositeExplicitAutograd: abs_
SparseCPU, SparseCUDA: abs_sparse_
SparseCsrCPU, SparseCsrCUDA: abs_sparse_csr_
NestedTensorCPU, NestedTensorCUDA: NestedTensor_abs_
- func: abs.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
device_check: NoCheck # TensorIterator
dispatch:
CPU, CUDA: abs_out
MPS: abs_out_mps
SparseCPU, SparseCUDA: abs_sparse_out
SparseCsrCPU, SparseCsrCUDA: abs_sparse_csr_out
tags: pointwise
# Note [Adding an alias]
# To add an alias do the following:
#
# 1) Copy the original functions native_functions.yaml entry, but replace the
# original function's name with their own and delete any dispatch
# keys for the aliases. Specifying a dispatch key will prevent
# autograd from recording the operations the alias performs, which
# will stop it from "inheriting" the original operation's autograd behavior.
# 2) Implement the corresponding functions and have them redispatch to the
# original function.
# 3) Add docstrings to the new function that reference the original function,
# and document the method as usual (if it exists.)
# (See torch/_torch_docs.py and docs/source/torch.rst if adding a function,
# torch/_tensor_docs.py and docs/source/tensors.rst if adding a method,
# or module-specific doc bindings (like torch/linalg/__init__.py) if
# adding an alias in a namespace.)
# 4) Update torch/overrides.py consistent with the original function.
# 5) Update the alias_map in torch/csrc/jit/passes/normalize_ops.cpp.
# 6) Add aliases argument to existing OpInfo/UnaryUfuncInfo or create new OpInfo/UnaryUfuncInfo entry
# in op_db list in torch/testing/_internal/common_methods_invocations.py
#
# See torch.absolute, an alias for torch.abs, as an example.
# Absolute, alias for abs
- func: absolute(Tensor self) -> Tensor
device_check: NoCheck # TensorIterator
variants: function, method
- func: absolute_(Tensor(a!) self) -> Tensor(a!)
device_check: NoCheck # TensorIterator
variants: method
- func: absolute.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
device_check: NoCheck # TensorIterator
- func: angle(Tensor self) -> Tensor
device_check: NoCheck # TensorIterator
variants: function, method
dispatch:
CPU, CUDA: angle
SparseCsrCPU, SparseCsrCUDA: angle_sparse_csr
tags: pointwise
- func: angle.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
device_check: NoCheck # TensorIterator
dispatch:
CPU, CUDA: angle_out
SparseCsrCPU, SparseCsrCUDA: angle_sparse_csr_out
tags: pointwise
- func: view_as_real(Tensor(a) self) -> Tensor(a)
variants: function
dispatch:
CPU, CUDA, MPS, Meta: view_as_real
- func: view_as_complex(Tensor(a) self) -> Tensor(a)
variants: function
dispatch:
CPU, CUDA, MPS, Meta: view_as_complex
- func: sgn(Tensor self) -> Tensor
variants: function, method
structured_delegate: sgn.out
dispatch:
SparseCPU, SparseCUDA: sgn_sparse
SparseCsrCPU, SparseCsrCUDA: sgn_sparse_csr
NestedTensorCPU, NestedTensorCUDA: NestedTensor_sgn
tags: pointwise
- func: sgn_(Tensor(a!) self) -> Tensor(a!)
variants: method
structured_delegate: sgn.out
dispatch:
SparseCPU, SparseCUDA: sgn_sparse_
SparseCsrCPU, SparseCsrCUDA: sgn_sparse_csr_
NestedTensorCPU, NestedTensorCUDA: NestedTensor_sgn_
tags: pointwise
- func: sgn.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
structured: True
structured_inherits: TensorIteratorBase
dispatch:
CPU, CUDA: sgn_out
MPS: sgn_out_mps
SparseCPU, SparseCUDA: sgn_sparse_out
SparseCsrCPU, SparseCsrCUDA: sgn_sparse_csr_out
tags: pointwise
- func: chalf(Tensor self, *, MemoryFormat? memory_format=None) -> Tensor
variants: method
- func: real(Tensor(a) self) -> Tensor(a)
device_check: NoCheck # TensorIterator
variants: function
- func: imag(Tensor(a) self) -> Tensor(a)
device_check: NoCheck # TensorIterator
variants: function
- func: _conj(Tensor(a) self) -> Tensor(a)
variants: function, method
dispatch:
CompositeExplicitAutograd: _conj
- func: conj(Tensor(a) self) -> Tensor(a)
variants: function, method
manual_cpp_binding: True
- func: _conj_physical(Tensor self) -> Tensor
variants: function, method
dispatch:
CompositeExplicitAutograd: _conj_physical
SparseCsrCPU, SparseCsrCUDA: conj_physical_sparse_csr
autogen: _conj_physical.out
- func: conj_physical(Tensor self) -> Tensor
variants: function, method
tags: pointwise
- func: conj_physical.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
dispatch:
CPU, CUDA: conj_physical_out
SparseCPU, SparseCUDA: conj_physical_out_sparse
SparseCsrCPU, SparseCsrCUDA: conj_physical_sparse_csr_out
tags: pointwise
- func: conj_physical_(Tensor(a!) self) -> Tensor(a!)
variants: function, method
dispatch:
CompositeExplicitAutograd: conj_physical_
SparseCsrCPU, SparseCsrCUDA: conj_physical_sparse_csr_
tags: pointwise
- func: resolve_conj(Tensor(a) self) -> Tensor(a)
variants: function, method
- func: resolve_neg(Tensor(a) self) -> Tensor(a)
variants: function, method
- func: _neg_view(Tensor(a) self) -> Tensor(a)
variants: function, method
dispatch:
CompositeExplicitAutograd: _neg_view
- func: acos(Tensor self) -> Tensor
device_check: NoCheck # TensorIterator
variants: function, method
structured_delegate: acos.out
tags: [core, pointwise]
- func: acos_(Tensor(a!) self) -> Tensor(a!)
device_check: NoCheck # TensorIterator
variants: function, method
structured_delegate: acos.out
tags: pointwise
- func: acos.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
device_check: NoCheck # TensorIterator
structured: True
structured_inherits: TensorIteratorBase
dispatch:
CPU, CUDA: acos_out
MPS: acos_out_mps
tags: pointwise
# arccos, alias of acos
- func: arccos(Tensor self) -> Tensor
variants: function, method
- func: arccos_(Tensor(a!) self) -> Tensor(a!)
variants: function, method
- func: arccos.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
- func: avg_pool1d(Tensor self, int[1] kernel_size, int[1] stride=[], int[1] padding=0, bool ceil_mode=False, bool count_include_pad=True) -> Tensor
tags: core
- func: adaptive_avg_pool1d(Tensor self, int[1] output_size) -> Tensor
tags: core
# Return: (Tensor output, Tensor indices)
- func: adaptive_max_pool1d(Tensor self, int[1] output_size) -> (Tensor, Tensor)
- func: add.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor
device_check: NoCheck # TensorIterator
structured_delegate: add.out
variants: function, method
dispatch:
SparseCPU, SparseCUDA: add_sparse
SparseCsrCPU, SparseCsrCUDA: add_sparse_csr
MkldnnCPU: mkldnn_add
ZeroTensor: add_zerotensor
NestedTensorCPU, NestedTensorCUDA: NestedTensor_add_Tensor
tags: [core, pointwise]
- func: add_.Tensor(Tensor(a!) self, Tensor other, *, Scalar alpha=1) -> Tensor(a!)
device_check: NoCheck # TensorIterator
variants: method
structured_delegate: add.out
dispatch:
SparseCPU, SparseCUDA: add_sparse_
SparseCsrCPU, SparseCsrCUDA: add_sparse_csr_
MkldnnCPU: mkldnn_add_
NestedTensorCPU, NestedTensorCUDA: NestedTensor_add__Tensor
tags: pointwise
- func: add.out(Tensor self, Tensor other, *, Scalar alpha=1, Tensor(a!) out) -> Tensor(a!)
device_check: NoCheck # TensorIterator
structured: True
structured_inherits: TensorIteratorBase
ufunc_inner_loop:
Generic: add (AllAndComplex, BFloat16, Half, ComplexHalf)
ScalarOnly: add (Bool)
dispatch:
SparseCPU: add_out_sparse_cpu
SparseCUDA: add_out_sparse_cuda
SparseCsrCPU: add_out_sparse_compressed_cpu
SparseCsrCUDA: add_out_sparse_compressed_cuda
MkldnnCPU: mkldnn_add_out
MPS: add_out_mps
tags: pointwise
- func: _add_relu.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor
variants: function
dispatch:
CPU: add_relu
- func: _add_relu_.Tensor(Tensor(a!) self, Tensor other, *, Scalar alpha=1) -> Tensor(a!)
variants: function
dispatch:
CPU: add_relu_
- func: _add_relu.out(Tensor self, Tensor other, *, Scalar alpha=1, Tensor(a!) out) -> Tensor(a!)
variants: function
dispatch:
CPU: add_relu_out
- func: _add_relu.Scalar(Tensor self, Scalar other, Scalar alpha=1) -> Tensor
variants: function
dispatch:
CPU: add_relu
- func: _add_relu_.Scalar(Tensor(a!) self, Scalar other, Scalar alpha=1) -> Tensor(a!)
variants: function
dispatch:
CPU: add_relu_
autogen: _add_relu.Scalar_out
# For C++ only, until we have conversion from C++ numbers to Tensor
- func: add.Scalar(Tensor self, Scalar other, Scalar alpha=1) -> Tensor
device_check: NoCheck # TensorIterator
variants: function, method
dispatch:
CompositeExplicitAutograd: add
tags: [core, pointwise]
- func: add_.Scalar(Tensor(a!) self, Scalar other, Scalar alpha=1) -> Tensor(a!)
device_check: NoCheck # TensorIterator
variants: method
dispatch:
CompositeExplicitAutograd: add_
autogen: add.Scalar_out
tags: pointwise
- func: addmv(Tensor self, Tensor mat, Tensor vec, *, Scalar beta=1, Scalar alpha=1) -> Tensor
structured_delegate: addmv.out
variants: function, method
- func: addmv_(Tensor(a!) self, Tensor mat, Tensor vec, *, Scalar beta=1, Scalar alpha=1) -> Tensor(a!)
structured_delegate: addmv.out
variants: function, method
- func: addmv.out(Tensor self, Tensor mat, Tensor vec, *, Scalar beta=1, Scalar alpha=1, Tensor(a!) out) -> Tensor(a!)
structured: True
dispatch:
CPU: addmv_out_cpu
CUDA: addmv_out_cuda
MPS: addmv_out_mps
SparseCsrCPU: addmv_out_sparse_compressed
SparseCsrCUDA: addmv_out_sparse_compressed_cuda
- func: addr(Tensor self, Tensor vec1, Tensor vec2, *, Scalar beta=1, Scalar alpha=1) -> Tensor
variants: function, method
dispatch:
CPU, CUDA: addr
MPS: addr_mps
CompositeExplicitAutograd: math_addr
- func: addr_(Tensor(a!) self, Tensor vec1, Tensor vec2, *, Scalar beta=1, Scalar alpha=1) -> Tensor(a!)
variants: method
dispatch:
CompositeExplicitAutograd: addr_
- func: addr.out(Tensor self, Tensor vec1, Tensor vec2, *, Scalar beta=1, Scalar alpha=1, Tensor(a!) out) -> Tensor(a!)
dispatch:
CPU, CUDA: addr_out
MPS: addr_out_mps
CompositeExplicitAutograd: math_addr_out
- func: affine_grid_generator(Tensor theta, SymInt[] size, bool align_corners) -> Tensor
variants: function
dispatch:
CompositeExplicitAutograd: affine_grid_generator
autogen: affine_grid_generator.out
- func: affine_grid_generator_backward(Tensor grad, SymInt[] size, bool align_corners) -> Tensor
variants: function
- func: _is_all_true(Tensor self) -> Tensor
variants: function, method
dispatch:
CompositeExplicitAutograd: _is_all_true
- func: _is_any_true(Tensor self) -> Tensor
variants: function, method
dispatch:
CompositeExplicitAutograd: _is_any_true
# Note: this function is only for testing.
- func: _test_check_tensor(Tensor self) -> Tensor
variants: function
# Note; this function is only for testing
- func: _test_functorch_fallback(Tensor self, Tensor other) -> Tensor
variants: function
dispatch:
CPU: _test_functorch_fallback
autogen: _test_functorch_fallback.out
- func: all.dim(Tensor self, int dim, bool keepdim=False) -> Tensor
device_check: NoCheck # TensorIterator
structured_delegate: all.out
variants: function, method
- func: all.dims(Tensor self, int[]? dim=None, bool keepdim=False) -> Tensor
device_check: NoCheck # TensorIterator
structured_delegate: all.dims_out
variants: function, method
cpp_no_default_args: ['dim']
dispatch:
CompositeExplicitAutograd: all_dims_default
- func: all.out(Tensor self, int dim, bool keepdim=False, *, Tensor(a!) out) -> Tensor(a!)
device_check: NoCheck # TensorIterator
structured: True
dispatch:
CPU, CUDA: all_out
MPS: all_out_mps
- func: all.dims_out(Tensor self, int[]? dim=None, bool keepdim=False, *, Tensor(a!) out) -> Tensor(a!)
device_check: NoCheck # TensorIterator
structured: True
dispatch:
CPU, CUDA: all_dims_out
CompositeExplicitAutograd: all_dims_out_default
cpp_no_default_args: ['dim']
- func: all.dimname(Tensor self, Dimname dim, bool keepdim=False) -> Tensor
device_check: NoCheck # TensorIterator
variants: function, method
- func: all.dimname_out(Tensor self, Dimname dim, bool keepdim=False, *, Tensor(a!) out) -> Tensor(a!)
device_check: NoCheck # TensorIterator
- func: allclose(Tensor self, Tensor other, float rtol=1e-05, float atol=1e-08, bool equal_nan=False) -> bool
variants: function, method
tags: data_dependent_output
dispatch:
CompositeExplicitAutograd: allclose
- func: any.dim(Tensor self, int dim, bool keepdim=False) -> Tensor
device_check: NoCheck # TensorIterator
structured_delegate: any.out
variants: function, method
tags: core
- func: any.dims(Tensor self, int[]? dim=None, bool keepdim=False) -> Tensor
device_check: NoCheck # TensorIterator
structured_delegate: any.dims_out
variants: function, method
cpp_no_default_args: ['dim']
tags: core
dispatch:
CompositeExplicitAutograd: any_dims_default
- func: any.out(Tensor self, int dim, bool keepdim=False, *, Tensor(a!) out) -> Tensor(a!)
device_check: NoCheck # TensorIterator
structured: True
dispatch:
CPU, CUDA: any_out
MPS: any_out_mps
- func: any.dims_out(Tensor self, int[]? dim=None, bool keepdim=False, *, Tensor(a!) out) -> Tensor(a!)
device_check: NoCheck # TensorIterator
structured: True
dispatch:
CPU, CUDA: any_dims_out
CompositeExplicitAutograd: any_dims_out_default
cpp_no_default_args: ['dim']
- func: any.dimname(Tensor self, Dimname dim, bool keepdim=False) -> Tensor
device_check: NoCheck # TensorIterator
variants: function, method
- func: any.dimname_out(Tensor self, Dimname dim, bool keepdim=False, *, Tensor(a!) out) -> Tensor(a!)
device_check: NoCheck # TensorIterator
- func: arange(Scalar end, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
dispatch:
CompositeExplicitAutograd: arange
- func: arange.start(Scalar start, Scalar end, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
dispatch:
CompositeExplicitAutograd: arange
# This operator should be named `aragne.start_out` if following the naming convention. However that
# name is already taken. Disabled because of CI job failures.
# FIXME: enable this
#- func: arange.start_out_(Scalar start, Scalar end, *, Tensor(a!) out) -> Tensor(a!)
# dispatch:
# CompositeExplicitAutograd: arange_start_out
- func: arange.start_step(Scalar start, Scalar end, Scalar step=1, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
dispatch:
CompositeExplicitAutograd: arange
cpp_no_default_args: ['step']
tags: core
- func: arange.out(Scalar end, *, Tensor(a!) out) -> Tensor(a!)
dispatch:
CompositeExplicitAutograd: arange_out
- func: arange.start_out(Scalar start, Scalar end, Scalar step=1, *, Tensor(a!) out) -> Tensor(a!)
dispatch:
CPU, Meta: arange_out
CUDA: arange_cuda_out
MPS: arange_mps_out
cpp_no_default_args: ['step']
# 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, int dim) -> Tensor
- func: argmax(Tensor self, int? dim=None, bool keepdim=False) -> Tensor
structured_delegate: argmax.out
device_check: NoCheck # TensorIterator
variants: function, method
tags: core
- func: argmax.out(Tensor self, int? dim=None, bool keepdim=False, *, Tensor(a!) out) -> Tensor(a!)
structured: True
dispatch:
CPU, CUDA: argmax_out
MPS: argmax_out_mps
- func: argmin(Tensor self, int? dim=None, bool keepdim=False) -> Tensor
structured_delegate: argmin.out
device_check: NoCheck # TensorIterator
variants: function, method
tags: core
- func: argmin.out(Tensor self, int? dim=None, bool keepdim=False, *, Tensor(a!) out) -> Tensor(a!)
structured: True
dispatch:
CPU, CUDA: argmin_out
MPS: argmin_out_mps
- func: acosh(Tensor self) -> Tensor
variants: function, method
structured_delegate: acosh.out
tags: [core, pointwise]
- func: acosh_(Tensor(a!) self) -> Tensor(a!)
variants: function, method
structured_delegate: acosh.out
tags: pointwise
- func: acosh.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
structured: True
structured_inherits: TensorIteratorBase
dispatch:
CPU, CUDA: acosh_out
MPS: acosh_out_mps
tags: pointwise
# arccosh, alias for acosh
- func: arccosh(Tensor self) -> Tensor
variants: function, method
- func: arccosh_(Tensor(a!) self) -> Tensor(a!)
variants: function, method
- func: arccosh.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
- func: asinh(Tensor self) -> Tensor
variants: function, method
structured_delegate: asinh.out
dispatch:
SparseCPU, SparseCUDA: asinh_sparse
SparseCsrCPU, SparseCsrCUDA: asinh_sparse_csr
tags: [core, pointwise]
- func: asinh_(Tensor(a!) self) -> Tensor(a!)
variants: function, method
structured_delegate: asinh.out
dispatch:
SparseCPU, SparseCUDA: asinh_sparse_
SparseCsrCPU, SparseCsrCUDA: asinh_sparse_csr_
tags: pointwise
- func: asinh.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
structured: True
structured_inherits: TensorIteratorBase
dispatch:
CPU, CUDA: asinh_out
MPS: asinh_out_mps
SparseCPU, SparseCUDA: asinh_sparse_out
SparseCsrCPU, SparseCsrCUDA: asinh_sparse_csr_out
tags: pointwise
# arcsinh, alias for asinh
- func: arcsinh(Tensor self) -> Tensor
variants: function, method
- func: arcsinh_(Tensor(a!) self) -> Tensor(a!)
variants: function, method
- func: arcsinh.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
- func: atanh(Tensor self) -> Tensor
structured_delegate: atanh.out
variants: function, method
dispatch:
SparseCPU, SparseCUDA: atanh_sparse
SparseCsrCPU, SparseCsrCUDA: atanh_sparse_csr
tags: [core, pointwise]
- func: atanh_(Tensor(a!) self) -> Tensor(a!)
structured_delegate: atanh.out
variants: function, method
dispatch:
SparseCPU, SparseCUDA: atanh_sparse_
SparseCsrCPU, SparseCsrCUDA: atanh_sparse_csr_
tags: pointwise
- func: atanh.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
structured: True
structured_inherits: TensorIteratorBase
dispatch:
CPU, CUDA: atanh_out
MPS: atanh_out_mps
SparseCPU, SparseCUDA: atanh_sparse_out
SparseCsrCPU, SparseCsrCUDA: atanh_sparse_csr_out
tags: pointwise
# arctanh, alias for atanh
- func: arctanh(Tensor self) -> Tensor
variants: function, method
- func: arctanh_(Tensor(a!) self) -> Tensor(a!)
variants: function, method
- func: arctanh.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
- func: as_strided(Tensor(a) self, SymInt[] size, SymInt[] stride, SymInt? storage_offset=None) -> Tensor(a)
variants: function, method
dispatch:
ZeroTensor, CPU, CUDA: as_strided_tensorimpl
Meta: as_strided_tensorimpl_meta_symint
MPS: as_strided_tensorimpl_mps
QuantizedCPU, QuantizedCUDA: as_strided_qtensorimpl
device_check: NoCheck
device_guard: False
tags: core
- func: as_strided_(Tensor(a!) self, SymInt[] size, SymInt[] stride, SymInt? storage_offset=None) -> Tensor(a!)
use_const_ref_for_mutable_tensors: True
variants: function, method
device_check: NoCheck
device_guard: False
tags: inplace_view
dispatch:
CompositeExplicitAutogradNonFunctional: as_strided__symint
- func: asin(Tensor self) -> Tensor
device_check: NoCheck # TensorIterator
variants: function, method
structured_delegate: asin.out
dispatch:
SparseCPU, SparseCUDA: asin_sparse
SparseCsrCPU, SparseCsrCUDA: asin_sparse_csr
tags: [core, pointwise]
- func: asin_(Tensor(a!) self) -> Tensor(a!)
device_check: NoCheck # TensorIterator
variants: function, method
structured_delegate: asin.out
dispatch:
SparseCPU, SparseCUDA: asin_sparse_
SparseCsrCPU, SparseCsrCUDA: asin_sparse_csr_
tags: pointwise
- func: asin.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
device_check: NoCheck # TensorIterator
structured: True
structured_inherits: TensorIteratorBase
dispatch:
CPU, CUDA: asin_out
MPS: asin_out_mps
SparseCPU, SparseCUDA: asin_sparse_out
SparseCsrCPU, SparseCsrCUDA: asin_sparse_csr_out
tags: pointwise
# arcsin, alias of asin
- func: arcsin(Tensor self) -> Tensor
variants: function, method
- func: arcsin_(Tensor(a!) self) -> Tensor(a!)
variants: function, method
- func: arcsin.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
- func: atan(Tensor self) -> Tensor
device_check: NoCheck # TensorIterator
structured_delegate: atan.out
variants: function, method
dispatch:
SparseCPU, SparseCUDA: atan_sparse
SparseCsrCPU, SparseCsrCUDA: atan_sparse_csr
tags: [core, pointwise]
- func: atan_(Tensor(a!) self) -> Tensor(a!)
device_check: NoCheck # TensorIterator
structured_delegate: atan.out
variants: function, method
dispatch:
SparseCPU, SparseCUDA: atan_sparse_
SparseCsrCPU, SparseCsrCUDA: atan_sparse_csr_
tags: pointwise