michaelu0826 commited on
Commit
e81d2f8
·
verified ·
1 Parent(s): de88b5f

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. lib/python3.11/site-packages/torch/fx/__pycache__/__init__.cpython-311.pyc +0 -0
  2. lib/python3.11/site-packages/torch/fx/__pycache__/_compatibility.cpython-311.pyc +0 -0
  3. lib/python3.11/site-packages/torch/fx/__pycache__/_lazy_graph_module.cpython-311.pyc +0 -0
  4. lib/python3.11/site-packages/torch/fx/__pycache__/_pytree.cpython-311.pyc +0 -0
  5. lib/python3.11/site-packages/torch/fx/__pycache__/_symbolic_trace.cpython-311.pyc +0 -0
  6. lib/python3.11/site-packages/torch/fx/__pycache__/_utils.cpython-311.pyc +0 -0
  7. lib/python3.11/site-packages/torch/fx/__pycache__/annotate.cpython-311.pyc +0 -0
  8. lib/python3.11/site-packages/torch/fx/__pycache__/config.cpython-311.pyc +0 -0
  9. lib/python3.11/site-packages/torch/fx/__pycache__/graph.cpython-311.pyc +0 -0
  10. lib/python3.11/site-packages/torch/fx/__pycache__/graph_module.cpython-311.pyc +0 -0
  11. lib/python3.11/site-packages/torch/fx/__pycache__/immutable_collections.cpython-311.pyc +0 -0
  12. lib/python3.11/site-packages/torch/fx/__pycache__/interpreter.cpython-311.pyc +0 -0
  13. lib/python3.11/site-packages/torch/fx/__pycache__/node.cpython-311.pyc +0 -0
  14. lib/python3.11/site-packages/torch/fx/__pycache__/operator_schemas.cpython-311.pyc +0 -0
  15. lib/python3.11/site-packages/torch/fx/__pycache__/proxy.cpython-311.pyc +0 -0
  16. lib/python3.11/site-packages/torch/fx/__pycache__/subgraph_rewriter.cpython-311.pyc +0 -0
  17. lib/python3.11/site-packages/torch/fx/__pycache__/tensor_type.cpython-311.pyc +0 -0
  18. lib/python3.11/site-packages/torch/fx/__pycache__/traceback.cpython-311.pyc +0 -0
  19. lib/python3.11/site-packages/torch/fx/passes/__pycache__/__init__.cpython-311.pyc +0 -0
  20. lib/python3.11/site-packages/torch/fx/passes/__pycache__/_tensorify_python_scalars.cpython-311.pyc +0 -0
  21. lib/python3.11/site-packages/torch/fx/passes/__pycache__/annotate_getitem_nodes.cpython-311.pyc +0 -0
  22. lib/python3.11/site-packages/torch/fx/passes/__pycache__/fake_tensor_prop.cpython-311.pyc +0 -0
  23. lib/python3.11/site-packages/torch/fx/passes/__pycache__/graph_drawer.cpython-311.pyc +0 -0
  24. lib/python3.11/site-packages/torch/fx/passes/__pycache__/graph_manipulation.cpython-311.pyc +0 -0
  25. lib/python3.11/site-packages/torch/fx/passes/__pycache__/graph_transform_observer.cpython-311.pyc +0 -0
  26. lib/python3.11/site-packages/torch/fx/passes/__pycache__/net_min_base.cpython-311.pyc +0 -0
  27. lib/python3.11/site-packages/torch/fx/passes/__pycache__/operator_support.cpython-311.pyc +0 -0
  28. lib/python3.11/site-packages/torch/fx/passes/__pycache__/param_fetch.cpython-311.pyc +0 -0
  29. lib/python3.11/site-packages/torch/fx/passes/__pycache__/pass_manager.cpython-311.pyc +0 -0
  30. lib/python3.11/site-packages/torch/fx/passes/__pycache__/reinplace.cpython-311.pyc +0 -0
  31. lib/python3.11/site-packages/torch/fx/passes/__pycache__/runtime_assert.cpython-311.pyc +0 -0
  32. lib/python3.11/site-packages/torch/fx/passes/__pycache__/shape_prop.cpython-311.pyc +0 -0
  33. lib/python3.11/site-packages/torch/fx/passes/__pycache__/split_module.cpython-311.pyc +0 -0
  34. lib/python3.11/site-packages/torch/fx/passes/__pycache__/split_utils.cpython-311.pyc +0 -0
  35. lib/python3.11/site-packages/torch/fx/passes/__pycache__/splitter_base.cpython-311.pyc +0 -0
  36. lib/python3.11/site-packages/torch/fx/passes/__pycache__/tools_common.cpython-311.pyc +0 -0
  37. lib/python3.11/site-packages/torch/fx/passes/utils/__pycache__/matcher_with_name_node_map_utils.cpython-311.pyc +0 -0
  38. lib/python3.11/site-packages/torch/fx/passes/utils/__pycache__/source_matcher_utils.cpython-311.pyc +0 -0
  39. lib/python3.11/site-packages/torch/include/ATen/ATen.h +37 -0
  40. lib/python3.11/site-packages/torch/include/ATen/AccumulateType.h +173 -0
  41. lib/python3.11/site-packages/torch/include/ATen/ArrayRef.h +2 -0
  42. lib/python3.11/site-packages/torch/include/ATen/Backend.h +2 -0
  43. lib/python3.11/site-packages/torch/include/ATen/Backtrace.h +2 -0
  44. lib/python3.11/site-packages/torch/include/ATen/BlasBackend.h +29 -0
  45. lib/python3.11/site-packages/torch/include/ATen/CPUApplyUtils.h +352 -0
  46. lib/python3.11/site-packages/torch/include/ATen/CPUFixedAllocator.h +33 -0
  47. lib/python3.11/site-packages/torch/include/ATen/CPUFunctions.h +29 -0
  48. lib/python3.11/site-packages/torch/include/ATen/CPUFunctions_inl.h +540 -0
  49. lib/python3.11/site-packages/torch/include/ATen/CPUGeneratorImpl.h +49 -0
  50. lib/python3.11/site-packages/torch/include/ATen/CUDAFunctions.h +29 -0
lib/python3.11/site-packages/torch/fx/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (4.49 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/_compatibility.cpython-311.pyc ADDED
Binary file (2.06 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/_lazy_graph_module.cpython-311.pyc ADDED
Binary file (9.04 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/_pytree.cpython-311.pyc ADDED
Binary file (5.87 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/_symbolic_trace.cpython-311.pyc ADDED
Binary file (59.2 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/_utils.cpython-311.pyc ADDED
Binary file (3.15 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/annotate.cpython-311.pyc ADDED
Binary file (1.57 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/config.cpython-311.pyc ADDED
Binary file (246 Bytes). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/graph.cpython-311.pyc ADDED
Binary file (96.7 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/graph_module.cpython-311.pyc ADDED
Binary file (46.6 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/immutable_collections.cpython-311.pyc ADDED
Binary file (4.58 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/interpreter.cpython-311.pyc ADDED
Binary file (29.9 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/node.cpython-311.pyc ADDED
Binary file (45 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/operator_schemas.cpython-311.pyc ADDED
Binary file (24.2 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/proxy.cpython-311.pyc ADDED
Binary file (36.6 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/subgraph_rewriter.cpython-311.pyc ADDED
Binary file (16.8 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/tensor_type.cpython-311.pyc ADDED
Binary file (5.87 kB). View file
 
lib/python3.11/site-packages/torch/fx/__pycache__/traceback.cpython-311.pyc ADDED
Binary file (9.96 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (636 Bytes). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/_tensorify_python_scalars.cpython-311.pyc ADDED
Binary file (14.1 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/annotate_getitem_nodes.cpython-311.pyc ADDED
Binary file (2.3 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/fake_tensor_prop.cpython-311.pyc ADDED
Binary file (4.98 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/graph_drawer.cpython-311.pyc ADDED
Binary file (22 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/graph_manipulation.cpython-311.pyc ADDED
Binary file (5.87 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/graph_transform_observer.cpython-311.pyc ADDED
Binary file (7.34 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/net_min_base.cpython-311.pyc ADDED
Binary file (43.4 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/operator_support.cpython-311.pyc ADDED
Binary file (11.4 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/param_fetch.cpython-311.pyc ADDED
Binary file (4.48 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/pass_manager.cpython-311.pyc ADDED
Binary file (10.5 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/reinplace.cpython-311.pyc ADDED
Binary file (30.6 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/runtime_assert.cpython-311.pyc ADDED
Binary file (26.6 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/shape_prop.cpython-311.pyc ADDED
Binary file (9.27 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/split_module.cpython-311.pyc ADDED
Binary file (27.6 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/split_utils.cpython-311.pyc ADDED
Binary file (12.2 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/splitter_base.cpython-311.pyc ADDED
Binary file (42.9 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/__pycache__/tools_common.cpython-311.pyc ADDED
Binary file (13.7 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/utils/__pycache__/matcher_with_name_node_map_utils.cpython-311.pyc ADDED
Binary file (5.75 kB). View file
 
lib/python3.11/site-packages/torch/fx/passes/utils/__pycache__/source_matcher_utils.cpython-311.pyc ADDED
Binary file (7.55 kB). View file
 
lib/python3.11/site-packages/torch/include/ATen/ATen.h ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #if !defined(_MSC_VER) && __cplusplus < 201703L
4
+ #error C++17 or later compatible compiler is required to use ATen.
5
+ #endif
6
+
7
+ #include <ATen/Context.h>
8
+ #include <ATen/Device.h>
9
+ #include <ATen/DeviceGuard.h>
10
+ #include <ATen/DimVector.h>
11
+ #include <ATen/Dispatch.h>
12
+ #include <ATen/Formatting.h>
13
+ #include <ATen/Functions.h>
14
+ #include <ATen/NamedTensor.h>
15
+ #include <ATen/ScalarOps.h>
16
+ #include <ATen/Tensor.h>
17
+ #include <ATen/TensorGeometry.h>
18
+ #include <ATen/TensorIndexing.h>
19
+ #include <ATen/TensorOperators.h>
20
+ #include <ATen/Version.h>
21
+ #include <ATen/core/ATenGeneral.h>
22
+ #include <ATen/core/Generator.h>
23
+ #include <ATen/core/Reduction.h>
24
+ #include <ATen/core/Scalar.h>
25
+ #include <ATen/core/UnsafeFromTH.h>
26
+ #include <ATen/core/ivalue.h>
27
+ #include <ATen/core/jit_type.h>
28
+ #include <c10/core/Allocator.h>
29
+ #include <c10/core/InferenceMode.h>
30
+ #include <c10/core/Layout.h>
31
+ #include <c10/core/Storage.h>
32
+ #include <c10/core/TensorOptions.h>
33
+ #include <c10/util/Exception.h>
34
+
35
+ // TODO: try to remove this
36
+ // There is some back story, see https://github.com/pytorch/pytorch/issues/48684
37
+ #include <ATen/NativeFunctions.h>
lib/python3.11/site-packages/torch/include/ATen/AccumulateType.h ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ #include <ATen/Config.h>
3
+ #include <c10/core/DeviceType.h>
4
+ #include <c10/core/ScalarType.h>
5
+ #include <c10/util/BFloat16.h>
6
+ #include <c10/util/Float8_e4m3fn.h>
7
+ #include <c10/util/Float8_e4m3fnuz.h>
8
+ #include <c10/util/Float8_e5m2.h>
9
+ #include <c10/util/Float8_e5m2fnuz.h>
10
+ #include <c10/util/Half.h>
11
+
12
+ // Defines the accumulation type for a scalar type.
13
+ // Example:
14
+ // using accscalar_t = acc_type<scalar_t, /*is_cuda*/true>;
15
+ //
16
+ // Accumulation types are an important concept in numeric computing
17
+ // because you frequently want to perform intermediate computations
18
+ // at a higher precision than the input and output precision, to avoid
19
+ // compounding internal rounding errors. Accumulation is the most
20
+ // well-known intermediate computation (it is of great importance for
21
+ // sum reduction and matrix multiply, for example), but in PyTorch
22
+ // acc_type ends up getting used for all sorts of other intermediate
23
+ // computations, so it perhaps would be more accurately (ahem) called an
24
+ // "accurate" type. acc_type is especially important for reduced
25
+ // precision operations like float16 and bfloat16, where relatively
26
+ // benign looking inputs can easily end up overflowing/underflowing.
27
+ //
28
+ // acc_type is parametrized by whether or not you are running on CUDA
29
+ // or not, because on CUDA double precision operations are expensive
30
+ // and so by default, we don't actually want to use double as an
31
+ // acc_type on CUDA. A lot of things are typed out below, but
32
+ // basically, the table is generated by a few rules:
33
+ //
34
+ // If bool:
35
+ // Use 'bool' as acc_type.
36
+ // If floating point:
37
+ // If CUDA, use 'float' as acc_type (unless scalar_t is double),
38
+ // otherwise (CPU) use 'double'
39
+ // If integral:
40
+ // Use 'int64_t' as acc_type
41
+ //
42
+ // You're not forced to use this template; if you happen to know
43
+ // something specific about your use case, you can specify your own
44
+ // desired behavior. This template, however, will give you a reasonable
45
+ // default that will work for all dtypes supported in PyTorch.
46
+
47
+ #if defined(__CUDACC__)
48
+ #include <cuda.h>
49
+ #include <cuda_fp16.h>
50
+ #elif defined(__HIPCC__)
51
+ #include <hip/hip_fp16.h>
52
+ #include <hip/hip_runtime.h>
53
+ #endif
54
+
55
+ namespace at {
56
+
57
+ template <typename T, c10::DeviceType D>
58
+ struct AccumulateTypeDevice {};
59
+
60
+ template <typename T, bool>
61
+ struct AccumulateType {};
62
+
63
+ template <typename T>
64
+ struct AccumulateType<T, false> {
65
+ using type = typename AccumulateTypeDevice<T, c10::DeviceType::CPU>::type;
66
+ };
67
+
68
+ template <typename T>
69
+ struct AccumulateType<T, true> {
70
+ using type = typename AccumulateTypeDevice<T, c10::DeviceType::CUDA>::type;
71
+ };
72
+
73
+ template <typename T, c10::DeviceType device>
74
+ using acc_type_device = typename AccumulateTypeDevice<T, device>::type;
75
+
76
+ template <typename T, bool is_cuda>
77
+ using acc_type = typename AccumulateType<T, is_cuda>::type;
78
+
79
+ #define ACC_TYPE(t, acc_t, device_type) \
80
+ template <> \
81
+ struct AccumulateTypeDevice<t, device_type> { \
82
+ using type = acc_t; \
83
+ };
84
+ #define MPS_ACC_TYPE(t, acc_t) ACC_TYPE(t, acc_t, c10::DeviceType::MPS)
85
+ #define XPU_ACC_TYPE(t, acc_t) ACC_TYPE(t, acc_t, c10::DeviceType::XPU)
86
+ #define CUDA_ACC_TYPE(t, acc_t) ACC_TYPE(t, acc_t, c10::DeviceType::CUDA)
87
+ #define CPU_ACC_TYPE(t, acc_t) ACC_TYPE(t, acc_t, c10::DeviceType::CPU)
88
+
89
+ MPS_ACC_TYPE(BFloat16, float)
90
+ MPS_ACC_TYPE(Half, float)
91
+ MPS_ACC_TYPE(Float8_e5m2, float)
92
+ MPS_ACC_TYPE(Float8_e4m3fn, float)
93
+ MPS_ACC_TYPE(Float8_e5m2fnuz, float)
94
+ MPS_ACC_TYPE(Float8_e4m3fnuz, float)
95
+ MPS_ACC_TYPE(float, float)
96
+ MPS_ACC_TYPE(double, float)
97
+ MPS_ACC_TYPE(int8_t, int64_t)
98
+ MPS_ACC_TYPE(uint8_t, int64_t)
99
+ MPS_ACC_TYPE(char, int64_t)
100
+ MPS_ACC_TYPE(int16_t, int64_t)
101
+ MPS_ACC_TYPE(int32_t, int64_t)
102
+ MPS_ACC_TYPE(int64_t, int64_t)
103
+ MPS_ACC_TYPE(bool, bool)
104
+ MPS_ACC_TYPE(c10::complex<Half>, c10::complex<float>)
105
+ MPS_ACC_TYPE(c10::complex<float>, c10::complex<float>)
106
+ MPS_ACC_TYPE(c10::complex<double>, c10::complex<float>)
107
+
108
+ XPU_ACC_TYPE(BFloat16, float)
109
+ XPU_ACC_TYPE(Half, float)
110
+ XPU_ACC_TYPE(Float8_e5m2, float)
111
+ XPU_ACC_TYPE(Float8_e4m3fn, float)
112
+ XPU_ACC_TYPE(Float8_e5m2fnuz, float)
113
+ XPU_ACC_TYPE(Float8_e4m3fnuz, float)
114
+ XPU_ACC_TYPE(float, float)
115
+ XPU_ACC_TYPE(double, double)
116
+ XPU_ACC_TYPE(int8_t, int64_t)
117
+ XPU_ACC_TYPE(uint8_t, int64_t)
118
+ XPU_ACC_TYPE(char, int64_t)
119
+ XPU_ACC_TYPE(int16_t, int64_t)
120
+ XPU_ACC_TYPE(int32_t, int64_t)
121
+ XPU_ACC_TYPE(int64_t, int64_t)
122
+ XPU_ACC_TYPE(bool, bool)
123
+ XPU_ACC_TYPE(c10::complex<Half>, c10::complex<float>)
124
+ XPU_ACC_TYPE(c10::complex<float>, c10::complex<float>)
125
+ XPU_ACC_TYPE(c10::complex<double>, c10::complex<double>)
126
+
127
+ #if defined(__CUDACC__) || defined(__HIPCC__)
128
+ CUDA_ACC_TYPE(half, float)
129
+ #endif
130
+ CUDA_ACC_TYPE(BFloat16, float)
131
+ CUDA_ACC_TYPE(Half, float)
132
+ CUDA_ACC_TYPE(Float8_e5m2, float)
133
+ CUDA_ACC_TYPE(Float8_e4m3fn, float)
134
+ CUDA_ACC_TYPE(Float8_e5m2fnuz, float)
135
+ CUDA_ACC_TYPE(Float8_e4m3fnuz, float)
136
+ CUDA_ACC_TYPE(float, float)
137
+ CUDA_ACC_TYPE(double, double)
138
+ CUDA_ACC_TYPE(int8_t, int64_t)
139
+ CUDA_ACC_TYPE(uint8_t, int64_t)
140
+ CUDA_ACC_TYPE(char, int64_t)
141
+ CUDA_ACC_TYPE(int16_t, int64_t)
142
+ CUDA_ACC_TYPE(int32_t, int64_t)
143
+ CUDA_ACC_TYPE(int64_t, int64_t)
144
+ CUDA_ACC_TYPE(bool, bool)
145
+ CUDA_ACC_TYPE(c10::complex<Half>, c10::complex<float>)
146
+ CUDA_ACC_TYPE(c10::complex<float>, c10::complex<float>)
147
+ CUDA_ACC_TYPE(c10::complex<double>, c10::complex<double>)
148
+
149
+ CPU_ACC_TYPE(BFloat16, float)
150
+ CPU_ACC_TYPE(Half, float)
151
+ CPU_ACC_TYPE(Float8_e5m2, float)
152
+ CPU_ACC_TYPE(Float8_e4m3fn, float)
153
+ CPU_ACC_TYPE(Float8_e5m2fnuz, float)
154
+ CPU_ACC_TYPE(Float8_e4m3fnuz, float)
155
+ CPU_ACC_TYPE(float, double)
156
+ CPU_ACC_TYPE(double, double)
157
+ CPU_ACC_TYPE(int8_t, int64_t)
158
+ CPU_ACC_TYPE(uint8_t, int64_t)
159
+ CPU_ACC_TYPE(char, int64_t)
160
+ CPU_ACC_TYPE(int16_t, int64_t)
161
+ CPU_ACC_TYPE(int32_t, int64_t)
162
+ CPU_ACC_TYPE(int64_t, int64_t)
163
+ CPU_ACC_TYPE(bool, bool)
164
+ CPU_ACC_TYPE(c10::complex<Half>, c10::complex<float>)
165
+ CPU_ACC_TYPE(c10::complex<float>, c10::complex<double>)
166
+ CPU_ACC_TYPE(c10::complex<double>, c10::complex<double>)
167
+
168
+ TORCH_API c10::ScalarType toAccumulateType(
169
+ c10::ScalarType type,
170
+ c10::DeviceType device);
171
+ TORCH_API c10::ScalarType toAccumulateType(c10::ScalarType type, bool is_cuda);
172
+
173
+ } // namespace at
lib/python3.11/site-packages/torch/include/ATen/ArrayRef.h ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ #pragma once
2
+ #include <c10/util/ArrayRef.h>
lib/python3.11/site-packages/torch/include/ATen/Backend.h ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ #pragma once
2
+ #include <c10/core/Backend.h>
lib/python3.11/site-packages/torch/include/ATen/Backtrace.h ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ #pragma once
2
+ #include <ATen/core/Backtrace.h>
lib/python3.11/site-packages/torch/include/ATen/BlasBackend.h ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <c10/util/Exception.h>
4
+
5
+ #include <ostream>
6
+ #include <string>
7
+
8
+ namespace at {
9
+
10
+ enum class BlasBackend : int8_t { Cublas, Cublaslt, Ck };
11
+
12
+ inline std::string BlasBackendToString(at::BlasBackend backend) {
13
+ switch (backend) {
14
+ case BlasBackend::Cublas:
15
+ return "at::BlasBackend::Cublas";
16
+ case BlasBackend::Cublaslt:
17
+ return "at::BlasBackend::Cublaslt";
18
+ case BlasBackend::Ck:
19
+ return "at::BlasBackend::Ck";
20
+ default:
21
+ TORCH_CHECK(false, "Unknown blas backend");
22
+ }
23
+ }
24
+
25
+ inline std::ostream& operator<<(std::ostream& stream, at::BlasBackend backend) {
26
+ return stream << BlasBackendToString(backend);
27
+ }
28
+
29
+ } // namespace at
lib/python3.11/site-packages/torch/include/ATen/CPUApplyUtils.h ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <ATen/CollapseDims.h>
4
+ #include <ATen/Parallel.h>
5
+ #include <ATen/TensorUtils.h>
6
+ #include <c10/util/irange.h>
7
+ #include <cstring>
8
+ #include <limits>
9
+
10
+ namespace at {
11
+
12
+ /*
13
+ * The basic strategy for apply is as follows:
14
+ *
15
+ * 1. Starting with the outermost index, loop until we reach a dimension where
16
+ * the data is no longer contiguous, i.e. the stride at that dimension is not
17
+ * equal to the size of the tensor defined by the outer dimensions. Let's call
18
+ * this outer (contiguous) tensor A. Note that if the Tensor is contiguous, then
19
+ * A is equal to the entire Tensor. Let's call the inner tensor B.
20
+ *
21
+ * 2. We loop through the indices in B, starting at its outermost dimension. For
22
+ * example, if B is a 2x2 matrix, then we do:
23
+ *
24
+ * B[0][0]
25
+ * B[0][1]
26
+ * B[1][0]
27
+ * B[1][1]
28
+ *
29
+ * We set the offset into the underlying storage as (storageOffset + stride_B *
30
+ * index_B), i.e. basically we compute the offset into the storage as we would
31
+ * normally for a Tensor. But because we are guaranteed the subsequent data is
32
+ * contiguous in memory, we can simply loop for sizeof(A) iterations and perform
33
+ * the operation, without having to follow the order described by the strides of
34
+ * A.
35
+ *
36
+ * 3. As an optimization, we merge dimensions of A that are contiguous in
37
+ * memory. For example, if A is a 3x3x3x3 tensor narrowed from a 3x3x4x3 tensor,
38
+ * then the first two dimensions can be merged for the purposes of APPLY,
39
+ * reducing the number of nested loops.
40
+ */
41
+
42
+ inline Tensor sort_strides(Tensor& tensor_) {
43
+ IntArrayRef strides = tensor_.strides();
44
+ std::vector<int64_t> indices;
45
+ indices.reserve(tensor_.ndimension());
46
+ for (const auto i : c10::irange(tensor_.ndimension())) {
47
+ indices.push_back(i);
48
+ }
49
+ std::sort(indices.begin(), indices.end(), [&strides](int64_t i1, int64_t i2) {
50
+ return strides[i1] > strides[i2];
51
+ });
52
+ Tensor tensor = tensor_.permute(indices);
53
+ return tensor;
54
+ }
55
+
56
+ template <typename T, int N>
57
+ struct strided_tensor_iter_fixed {
58
+ public:
59
+ T* data_ = NULL;
60
+ int64_t dim_ = 0;
61
+
62
+ // NOLINTNEXTLINE(*array*)
63
+ int64_t counter_[N] = {0};
64
+ // NOLINTNEXTLINE(*array*)
65
+ int64_t sizes_[N] = {0};
66
+ // NOLINTNEXTLINE(*array*)
67
+ int64_t strides_[N] = {0};
68
+
69
+ strided_tensor_iter_fixed(strided_tensor_iter_fixed const&) = delete;
70
+ strided_tensor_iter_fixed& operator=(strided_tensor_iter_fixed const& x) =
71
+ delete;
72
+ strided_tensor_iter_fixed(strided_tensor_iter_fixed&&) noexcept = default;
73
+ strided_tensor_iter_fixed& operator=(strided_tensor_iter_fixed&& x) noexcept =
74
+ default;
75
+ ~strided_tensor_iter_fixed() noexcept = default;
76
+ strided_tensor_iter_fixed(
77
+ Tensor& tensor,
78
+ [[maybe_unused]] bool sort_strides = false)
79
+ : data_(tensor.data_ptr<T>()) {
80
+ std::memset(counter_, 0, sizeof(int64_t) * N);
81
+ if (tensor.dim() > 0) {
82
+ std::memcpy(
83
+ sizes_, tensor.sizes().data(), tensor.dim() * sizeof(int64_t));
84
+ std::memcpy(
85
+ strides_, tensor.strides().data(), tensor.dim() * sizeof(int64_t));
86
+ }
87
+ dim_ = std::get<1>(collapse_dims(sizes_, strides_, tensor.ndimension()));
88
+ }
89
+ };
90
+
91
+ template <typename T>
92
+ struct strided_tensor_iter {
93
+ private:
94
+ public:
95
+ T* data_ = NULL;
96
+ int64_t dim_;
97
+
98
+ std::vector<int64_t> counter_;
99
+ std::vector<int64_t> sizes_;
100
+ std::vector<int64_t> strides_;
101
+
102
+ strided_tensor_iter(strided_tensor_iter const&) = delete;
103
+ strided_tensor_iter& operator=(strided_tensor_iter const& x) = delete;
104
+ strided_tensor_iter(strided_tensor_iter&&) noexcept = default;
105
+ strided_tensor_iter& operator=(strided_tensor_iter&&) noexcept = default;
106
+ ~strided_tensor_iter() noexcept = default;
107
+ strided_tensor_iter(Tensor& tensor)
108
+ : data_(tensor.data_ptr<T>()),
109
+ dim_(tensor.ndimension()),
110
+ counter_(dim_, 0),
111
+ sizes_(tensor.sizes().vec()),
112
+ strides_(tensor.strides().vec()) {
113
+ dim_ = std::get<1>(collapse_dims(sizes_.data(), strides_.data(), dim_));
114
+ }
115
+ };
116
+
117
+ inline bool _all_equal_numel(at::ArrayRef<Tensor> tensors) {
118
+ if (tensors.empty())
119
+ return true;
120
+ int64_t all_numel = tensors[0].numel();
121
+ for (const auto i : c10::irange(1, tensors.size())) {
122
+ if (tensors[i].numel() != all_numel)
123
+ return false;
124
+ }
125
+ return true;
126
+ }
127
+
128
+ inline std::string _all_equal_numel_error(at::ArrayRef<Tensor> tensors) {
129
+ std::ostringstream oss;
130
+ oss << "inconsistent tensor size, expected ";
131
+ for (size_t i = 0; i < tensors.size() - 1; i++) {
132
+ oss << tensors[i].sizes() << ", ";
133
+ }
134
+ oss << "and " << tensors[tensors.size() - 1].sizes()
135
+ << " to have the same number of elements, but got ";
136
+ for (size_t i = 0; i < tensors.size() - 1; i++) {
137
+ oss << tensors[i].numel() << ", ";
138
+ }
139
+ oss << "and " << tensors[tensors.size() - 1].numel()
140
+ << " elements respectively";
141
+ return oss.str();
142
+ }
143
+
144
+ inline bool _apply_preamble(ArrayRef<Tensor> tensors) {
145
+ checkDeviceType("CPU_tensor_apply", tensors, kCPU);
146
+ checkLayout("CPU_tensor_apply", tensors, kStrided);
147
+ if (!_all_equal_numel(tensors))
148
+ TORCH_CHECK(false, _all_equal_numel_error(tensors));
149
+ // An empty tensor has no elements
150
+ for (auto& t : tensors)
151
+ if (t.numel() == 0)
152
+ return false;
153
+ return true;
154
+ }
155
+
156
+ inline int64_t _max_dim_tensors(ArrayRef<Tensor> tensors) {
157
+ int64_t dim = 0;
158
+ for (auto& t : tensors)
159
+ dim = std::max(dim, t.ndimension());
160
+ return dim;
161
+ }
162
+
163
+ inline void iterate(int64_t /*size*/) {}
164
+
165
+ template <typename Arg, typename... Args>
166
+ inline void iterate(int64_t size, Arg& iter, Args&... iter_tail) {
167
+ iter.counter_[iter.dim_ - 1] += size;
168
+ iter.data_ = iter.data_ + size * iter.strides_[iter.dim_ - 1];
169
+ iterate(size, iter_tail...);
170
+ }
171
+
172
+ inline bool iterate_continue() {
173
+ return true;
174
+ }
175
+
176
+ template <typename Arg, typename... Args>
177
+ inline bool iterate_continue(Arg& iter, Args&... iter_tail) {
178
+ return iter.counter_[iter.dim_ - 1] < iter.sizes_[iter.dim_ - 1] &&
179
+ iterate_continue(iter_tail...);
180
+ }
181
+
182
+ inline int64_t max_iterate_size() {
183
+ return std::numeric_limits<int64_t>::max();
184
+ }
185
+
186
+ template <typename Arg, typename... Args>
187
+ inline int64_t max_iterate_size(Arg& iter, Args&... iter_tail) {
188
+ return std::min(
189
+ (iter.sizes_[iter.dim_ - 1] - iter.counter_[iter.dim_ - 1]),
190
+ max_iterate_size(iter_tail...));
191
+ }
192
+
193
+ inline void iterate_overflow() {}
194
+
195
+ template <typename Arg, typename... Args>
196
+ inline void iterate_overflow(Arg& iter, Args&... iter_tail) {
197
+ if (iter.counter_[iter.dim_ - 1] == iter.sizes_[iter.dim_ - 1]) {
198
+ for (int64_t i = iter.dim_ - 1; i > 0; i--) {
199
+ if (iter.counter_[i] == iter.sizes_[i]) {
200
+ iter.counter_[i] = 0;
201
+ iter.counter_[i - 1]++;
202
+ iter.data_ = iter.data_ - (iter.sizes_[i] * iter.strides_[i]) +
203
+ iter.strides_[i - 1];
204
+ }
205
+ }
206
+ }
207
+ iterate_overflow(iter_tail...);
208
+ }
209
+
210
+ inline void forward(int64_t /*offset*/) {}
211
+
212
+ template <typename Arg, typename... Args>
213
+ inline void forward(int64_t offset, Arg& iter, Args&... iter_tail) {
214
+ int64_t multi = offset;
215
+ for (int64_t i = iter.dim_ - 1; i >= 0; i--) {
216
+ int64_t inc = multi % iter.sizes_[i];
217
+ multi = multi / iter.sizes_[i];
218
+ iter.data_ = iter.data_ + inc * iter.strides_[i];
219
+ iter.counter_[i] += inc;
220
+ }
221
+ forward(offset, iter_tail...);
222
+ }
223
+
224
+ inline int64_t max_dim() {
225
+ return 0;
226
+ }
227
+
228
+ template <typename Arg, typename... Args>
229
+ inline int64_t max_dim(Arg& iter, Args&... iter_tail) {
230
+ return std::max(iter.dim_, max_dim(iter_tail...));
231
+ }
232
+
233
+ inline void apply_op() {}
234
+
235
+ template <typename Op, typename... Args>
236
+ inline void apply_op(
237
+ int64_t numel,
238
+ int64_t offset,
239
+ const Op& op,
240
+ Args... iters) {
241
+ // For 0-dim tensors
242
+ if (numel == 1 && max_dim(iters...) == 0) {
243
+ op(*iters.data_...);
244
+ return;
245
+ }
246
+ if (offset > 0)
247
+ forward(offset, iters...);
248
+ // Splitting this into chunks helps the compiler create faster assembly
249
+ for (int64_t i = 0; i < numel;) {
250
+ for (; iterate_continue(iters...) && i < numel;) {
251
+ op(*iters.data_...);
252
+ iterate(1, iters...);
253
+ i++;
254
+ }
255
+ iterate_overflow(iters...);
256
+ }
257
+ }
258
+
259
+ /*
260
+ Apply a pointwise operator to sequence of tensors
261
+
262
+ The calling convention for op is a function/functor that takes the same
263
+ number of pointers of type scalar as the number of given tensors. For example,
264
+ to compute a = b * c, op would be of the form:
265
+ [](scalar* a_val, const scalar* b_val, const scalar* c_val) { a_val[0] =
266
+ b_val[0] * c_val[0]; };
267
+ */
268
+
269
+ template <typename scalar1, typename scalar2, typename Op>
270
+ inline void CPU_tensor_apply2(Tensor tensor1, Tensor tensor2, const Op op) {
271
+ if (!_apply_preamble({tensor1, tensor2}))
272
+ return;
273
+ if (_max_dim_tensors({tensor1, tensor2}) <= 8) {
274
+ apply_op(
275
+ tensor1.numel(),
276
+ 0,
277
+ op,
278
+ strided_tensor_iter_fixed<scalar1, 8>(tensor1),
279
+ strided_tensor_iter_fixed<scalar2, 8>(tensor2));
280
+ } else {
281
+ apply_op(
282
+ tensor1.numel(),
283
+ 0,
284
+ op,
285
+ strided_tensor_iter<scalar1>(tensor1),
286
+ strided_tensor_iter<scalar2>(tensor2));
287
+ }
288
+ }
289
+
290
+ template <typename scalar1, typename scalar2, typename scalar3, typename Op>
291
+ inline void CPU_tensor_apply3(
292
+ Tensor tensor1,
293
+ Tensor tensor2,
294
+ Tensor tensor3,
295
+ const Op op) {
296
+ if (!_apply_preamble({tensor1, tensor2, tensor3}))
297
+ return;
298
+ if (_max_dim_tensors({tensor1, tensor2, tensor3}) <= 8) {
299
+ apply_op(
300
+ tensor1.numel(),
301
+ 0,
302
+ op,
303
+ strided_tensor_iter_fixed<scalar1, 8>(tensor1),
304
+ strided_tensor_iter_fixed<scalar2, 8>(tensor2),
305
+ strided_tensor_iter_fixed<scalar3, 8>(tensor3));
306
+ } else {
307
+ apply_op(
308
+ tensor1.numel(),
309
+ 0,
310
+ op,
311
+ strided_tensor_iter<scalar1>(tensor1),
312
+ strided_tensor_iter<scalar2>(tensor2),
313
+ strided_tensor_iter<scalar3>(tensor3));
314
+ }
315
+ }
316
+
317
+ template <
318
+ typename scalar1,
319
+ typename scalar2,
320
+ typename scalar3,
321
+ typename scalar4,
322
+ typename Op>
323
+ inline void CPU_tensor_apply4(
324
+ Tensor tensor1,
325
+ Tensor tensor2,
326
+ Tensor tensor3,
327
+ Tensor tensor4,
328
+ const Op op) {
329
+ if (!_apply_preamble({tensor1, tensor2, tensor3, tensor4}))
330
+ return;
331
+ if (_max_dim_tensors({tensor1, tensor2, tensor3, tensor4}) <= 8) {
332
+ apply_op(
333
+ tensor1.numel(),
334
+ 0,
335
+ op,
336
+ strided_tensor_iter_fixed<scalar1, 8>(tensor1),
337
+ strided_tensor_iter_fixed<scalar2, 8>(tensor2),
338
+ strided_tensor_iter_fixed<scalar3, 8>(tensor3),
339
+ strided_tensor_iter_fixed<scalar4, 8>(tensor4));
340
+ } else {
341
+ apply_op(
342
+ tensor1.numel(),
343
+ 0,
344
+ op,
345
+ strided_tensor_iter<scalar1>(tensor1),
346
+ strided_tensor_iter<scalar2>(tensor2),
347
+ strided_tensor_iter<scalar3>(tensor3),
348
+ strided_tensor_iter<scalar4>(tensor4));
349
+ }
350
+ }
351
+
352
+ } // namespace at
lib/python3.11/site-packages/torch/include/ATen/CPUFixedAllocator.h ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <c10/core/Allocator.h>
4
+ #include <c10/util/Exception.h>
5
+
6
+ // This file creates a fake allocator that just throws exceptions if
7
+ // it is actually used.
8
+
9
+ // state passed to the allocator is the std::function<void(void*)> called
10
+ // when the blob is release by ATen
11
+
12
+ namespace at {
13
+
14
+ static void* cpu_fixed_malloc(void*, ptrdiff_t) {
15
+ TORCH_CHECK(false, "attempting to resize a tensor view of an external blob");
16
+ }
17
+
18
+ static void* cpu_fixed_realloc(void*, void*, ptrdiff_t) {
19
+ TORCH_CHECK(false, "attempting to resize a tensor view of an external blob");
20
+ }
21
+
22
+ static void cpu_fixed_free(void* state, void* allocation) {
23
+ auto on_release = static_cast<std::function<void(void*)>*>(state);
24
+ (*on_release)(allocation);
25
+ delete on_release;
26
+ }
27
+
28
+ static Allocator CPU_fixed_allocator = {
29
+ cpu_fixed_malloc,
30
+ cpu_fixed_realloc,
31
+ cpu_fixed_free};
32
+
33
+ } // namespace at
lib/python3.11/site-packages/torch/include/ATen/CPUFunctions.h ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <ATen/core/TensorBody.h>
2
+
3
+ // TODO Undo all logic introduced for Note [Avoiding Include Cycles In Static Dispatch]
4
+ // Code introduced to avoid cyclic dependency in static dispatch is no longer
5
+ // needed as static dispatch logic is moved from TensorBody.h, which caused cycles in the first place,
6
+ // to Operators.cpp for supporting multiple backends with multiple kernels.
7
+ //
8
+ // Note [Avoiding Include Cycles In Static Dispatch]
9
+ // In order to avoid #include cycles in the static dispatch build, we've carefully split out
10
+ // the static function definition files into {DispatchKey}Functions.h and {DispatchKey}Functions_inl.h.
11
+ //
12
+ // Without this split, the include cycle looks like TensorBody.h -> CPUFunctions.h -> TensorBody.h.
13
+ // - TensorBody.h #includes CPUFunctions.h in the static dispatch build, because the tensor methods
14
+ // all need to call into the fastpath C++ API defined in CPUFunctions.h. The methods are also all
15
+ // directly inlined into TensorBody.h.
16
+ // - CPUFunctions.h #includes TensorBody.h because it contains function declarations for the entire C++ API,
17
+ // which include functions that have defaultable std::optional<Tensor> arguments.
18
+ // That requires knowing the full Tensor class definition.
19
+ //
20
+ // We break the cycle by doing the following:
21
+ // - Split out CPUFunction.h into two files: CPUFunctions.h and CPUFunctions_inl.h
22
+ // - CPUFunction.h is a dummy file that just includes the Tensor class and includes CPUFunctions_inl.,
23
+ // - CPUFunctions_inl.h includes everything else
24
+ // - (only in the static dispatch build) TensorBody.h makes sure to finish defining the Tensor class,
25
+ // and then it includes CPUFunctions_inl.h.
26
+ // - All other files that want the cpu fastpath functions can include CPUFunctions.h directly.
27
+ // - This also means that static dispatch build, CPUFunctions.h only needs to
28
+ // #include TensorBody.h, and it will automatically bring in CPUFunctions_inl.h.
29
+ #include <ATen/CPUFunctions_inl.h>
lib/python3.11/site-packages/torch/include/ATen/CPUFunctions_inl.h ADDED
@@ -0,0 +1,540 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunctions_inl.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ #if defined(AT_PER_OPERATOR_HEADERS) && defined(TORCH_ASSERT_ONLY_METHOD_OPERATORS)
12
+ #error This change adds a dependency on all pytorch operators, meaning the \
13
+ file will need to be re-compiled every time an operator is changed or added. \
14
+ Consider including a specific operator from \
15
+ <ATen/ops/{my_operator}_cpu_dispatch.h>. \
16
+ See NOTE [TORCH_ASSERT_ONLY_METHOD_OPERATORS].
17
+ #endif
18
+
19
+ #include <ATen/ops/_adaptive_avg_pool2d_cpu_dispatch.h>
20
+ #include <ATen/ops/_adaptive_avg_pool2d_backward_cpu_dispatch.h>
21
+ #include <ATen/ops/_adaptive_avg_pool3d_cpu_dispatch.h>
22
+ #include <ATen/ops/_adaptive_avg_pool3d_backward_cpu_dispatch.h>
23
+ #include <ATen/ops/_add_relu_cpu_dispatch.h>
24
+ #include <ATen/ops/_addmm_activation_cpu_dispatch.h>
25
+ #include <ATen/ops/_aminmax_cpu_dispatch.h>
26
+ #include <ATen/ops/_amp_foreach_non_finite_check_and_unscale_cpu_dispatch.h>
27
+ #include <ATen/ops/_amp_update_scale_cpu_dispatch.h>
28
+ #include <ATen/ops/_assert_async_cpu_dispatch.h>
29
+ #include <ATen/ops/_batch_norm_with_update_cpu_dispatch.h>
30
+ #include <ATen/ops/_cdist_backward_cpu_dispatch.h>
31
+ #include <ATen/ops/_cdist_forward_cpu_dispatch.h>
32
+ #include <ATen/ops/_cholesky_solve_helper_cpu_dispatch.h>
33
+ #include <ATen/ops/_compute_linear_combination_cpu_dispatch.h>
34
+ #include <ATen/ops/_convert_indices_from_coo_to_csr_cpu_dispatch.h>
35
+ #include <ATen/ops/_convert_indices_from_csr_to_coo_cpu_dispatch.h>
36
+ #include <ATen/ops/_convert_weight_to_int4pack_for_cpu_cpu_dispatch.h>
37
+ #include <ATen/ops/_ctc_loss_cpu_dispatch.h>
38
+ #include <ATen/ops/_ctc_loss_backward_cpu_dispatch.h>
39
+ #include <ATen/ops/_cummax_helper_cpu_dispatch.h>
40
+ #include <ATen/ops/_cummin_helper_cpu_dispatch.h>
41
+ #include <ATen/ops/_dirichlet_grad_cpu_dispatch.h>
42
+ #include <ATen/ops/_efficientzerotensor_cpu_dispatch.h>
43
+ #include <ATen/ops/_embedding_bag_cpu_dispatch.h>
44
+ #include <ATen/ops/_embedding_bag_backward_cpu_dispatch.h>
45
+ #include <ATen/ops/_embedding_bag_dense_backward_cpu_dispatch.h>
46
+ #include <ATen/ops/_embedding_bag_forward_only_cpu_dispatch.h>
47
+ #include <ATen/ops/_embedding_bag_per_sample_weights_backward_cpu_dispatch.h>
48
+ #include <ATen/ops/_empty_affine_quantized_cpu_dispatch.h>
49
+ #include <ATen/ops/_empty_per_channel_affine_quantized_cpu_dispatch.h>
50
+ #include <ATen/ops/_fake_quantize_learnable_per_channel_affine_cpu_dispatch.h>
51
+ #include <ATen/ops/_fake_quantize_learnable_per_channel_affine_backward_cpu_dispatch.h>
52
+ #include <ATen/ops/_fake_quantize_learnable_per_tensor_affine_cpu_dispatch.h>
53
+ #include <ATen/ops/_fake_quantize_learnable_per_tensor_affine_backward_cpu_dispatch.h>
54
+ #include <ATen/ops/_fake_quantize_per_tensor_affine_cachemask_tensor_qparams_cpu_dispatch.h>
55
+ #include <ATen/ops/_fft_c2c_cpu_dispatch.h>
56
+ #include <ATen/ops/_fft_c2r_cpu_dispatch.h>
57
+ #include <ATen/ops/_fft_r2c_cpu_dispatch.h>
58
+ #include <ATen/ops/_foobar_cpu_dispatch.h>
59
+ #include <ATen/ops/_functional_assert_async_cpu_dispatch.h>
60
+ #include <ATen/ops/_fused_adagrad_cpu_dispatch.h>
61
+ #include <ATen/ops/_fused_adam_cpu_dispatch.h>
62
+ #include <ATen/ops/_fused_adamw_cpu_dispatch.h>
63
+ #include <ATen/ops/_fused_moving_avg_obs_fq_helper_cpu_dispatch.h>
64
+ #include <ATen/ops/_fused_sdp_choice_cpu_dispatch.h>
65
+ #include <ATen/ops/_fused_sgd_cpu_dispatch.h>
66
+ #include <ATen/ops/_histogramdd_bin_edges_cpu_dispatch.h>
67
+ #include <ATen/ops/_histogramdd_from_bin_cts_cpu_dispatch.h>
68
+ #include <ATen/ops/_histogramdd_from_bin_tensors_cpu_dispatch.h>
69
+ #include <ATen/ops/_index_put_impl_cpu_dispatch.h>
70
+ #include <ATen/ops/_int_mm_cpu_dispatch.h>
71
+ #include <ATen/ops/_jagged_to_padded_dense_forward_cpu_dispatch.h>
72
+ #include <ATen/ops/_linalg_det_cpu_dispatch.h>
73
+ #include <ATen/ops/_linalg_eigh_cpu_dispatch.h>
74
+ #include <ATen/ops/_linalg_eigvals_cpu_dispatch.h>
75
+ #include <ATen/ops/_linalg_slogdet_cpu_dispatch.h>
76
+ #include <ATen/ops/_linalg_solve_ex_cpu_dispatch.h>
77
+ #include <ATen/ops/_linalg_svd_cpu_dispatch.h>
78
+ #include <ATen/ops/_local_scalar_dense_cpu_dispatch.h>
79
+ #include <ATen/ops/_log_softmax_cpu_dispatch.h>
80
+ #include <ATen/ops/_log_softmax_backward_data_cpu_dispatch.h>
81
+ #include <ATen/ops/_logcumsumexp_cpu_dispatch.h>
82
+ #include <ATen/ops/_make_dep_token_cpu_dispatch.h>
83
+ #include <ATen/ops/_make_per_channel_quantized_tensor_cpu_dispatch.h>
84
+ #include <ATen/ops/_make_per_tensor_quantized_tensor_cpu_dispatch.h>
85
+ #include <ATen/ops/_masked_softmax_cpu_dispatch.h>
86
+ #include <ATen/ops/_masked_softmax_backward_cpu_dispatch.h>
87
+ #include <ATen/ops/_native_batch_norm_legit_cpu_dispatch.h>
88
+ #include <ATen/ops/_native_multi_head_attention_cpu_dispatch.h>
89
+ #include <ATen/ops/_nested_compute_contiguous_strides_offsets_cpu_dispatch.h>
90
+ #include <ATen/ops/_nested_from_padded_cpu_dispatch.h>
91
+ #include <ATen/ops/_nested_tensor_from_mask_cpu_dispatch.h>
92
+ #include <ATen/ops/_nested_tensor_from_mask_left_aligned_cpu_dispatch.h>
93
+ #include <ATen/ops/_nested_view_from_buffer_cpu_dispatch.h>
94
+ #include <ATen/ops/_padded_dense_to_jagged_forward_cpu_dispatch.h>
95
+ #include <ATen/ops/_pdist_backward_cpu_dispatch.h>
96
+ #include <ATen/ops/_pdist_forward_cpu_dispatch.h>
97
+ #include <ATen/ops/_prelu_kernel_cpu_dispatch.h>
98
+ #include <ATen/ops/_prelu_kernel_backward_cpu_dispatch.h>
99
+ #include <ATen/ops/_reshape_alias_cpu_dispatch.h>
100
+ #include <ATen/ops/_sample_dirichlet_cpu_dispatch.h>
101
+ #include <ATen/ops/_scaled_dot_product_flash_attention_for_cpu_cpu_dispatch.h>
102
+ #include <ATen/ops/_scaled_dot_product_flash_attention_for_cpu_backward_cpu_dispatch.h>
103
+ #include <ATen/ops/_segment_reduce_backward_cpu_dispatch.h>
104
+ #include <ATen/ops/_slow_conv2d_backward_cpu_dispatch.h>
105
+ #include <ATen/ops/_slow_conv2d_forward_cpu_dispatch.h>
106
+ #include <ATen/ops/_softmax_cpu_dispatch.h>
107
+ #include <ATen/ops/_softmax_backward_data_cpu_dispatch.h>
108
+ #include <ATen/ops/_spdiags_cpu_dispatch.h>
109
+ #include <ATen/ops/_stack_cpu_dispatch.h>
110
+ #include <ATen/ops/_standard_gamma_cpu_dispatch.h>
111
+ #include <ATen/ops/_standard_gamma_grad_cpu_dispatch.h>
112
+ #include <ATen/ops/_test_functorch_fallback_cpu_dispatch.h>
113
+ #include <ATen/ops/_test_optional_filled_intlist_cpu_dispatch.h>
114
+ #include <ATen/ops/_test_optional_floatlist_cpu_dispatch.h>
115
+ #include <ATen/ops/_test_optional_intlist_cpu_dispatch.h>
116
+ #include <ATen/ops/_to_sparse_cpu_dispatch.h>
117
+ #include <ATen/ops/_to_sparse_bsc_cpu_dispatch.h>
118
+ #include <ATen/ops/_to_sparse_bsr_cpu_dispatch.h>
119
+ #include <ATen/ops/_to_sparse_csc_cpu_dispatch.h>
120
+ #include <ATen/ops/_to_sparse_csr_cpu_dispatch.h>
121
+ #include <ATen/ops/_transform_bias_rescale_qkv_cpu_dispatch.h>
122
+ #include <ATen/ops/_transformer_encoder_layer_fwd_cpu_dispatch.h>
123
+ #include <ATen/ops/_unique_cpu_dispatch.h>
124
+ #include <ATen/ops/_unique2_cpu_dispatch.h>
125
+ #include <ATen/ops/_upsample_bicubic2d_aa_cpu_dispatch.h>
126
+ #include <ATen/ops/_upsample_bicubic2d_aa_backward_cpu_dispatch.h>
127
+ #include <ATen/ops/_upsample_bilinear2d_aa_cpu_dispatch.h>
128
+ #include <ATen/ops/_upsample_bilinear2d_aa_backward_cpu_dispatch.h>
129
+ #include <ATen/ops/_upsample_nearest_exact1d_cpu_dispatch.h>
130
+ #include <ATen/ops/_upsample_nearest_exact1d_backward_cpu_dispatch.h>
131
+ #include <ATen/ops/_upsample_nearest_exact2d_cpu_dispatch.h>
132
+ #include <ATen/ops/_upsample_nearest_exact2d_backward_cpu_dispatch.h>
133
+ #include <ATen/ops/_upsample_nearest_exact3d_cpu_dispatch.h>
134
+ #include <ATen/ops/_upsample_nearest_exact3d_backward_cpu_dispatch.h>
135
+ #include <ATen/ops/_validate_compressed_sparse_indices_cpu_dispatch.h>
136
+ #include <ATen/ops/_weight_int4pack_mm_for_cpu_cpu_dispatch.h>
137
+ #include <ATen/ops/_weight_int8pack_mm_cpu_dispatch.h>
138
+ #include <ATen/ops/_weight_norm_interface_cpu_dispatch.h>
139
+ #include <ATen/ops/_weight_norm_interface_backward_cpu_dispatch.h>
140
+ #include <ATen/ops/abs_cpu_dispatch.h>
141
+ #include <ATen/ops/acos_cpu_dispatch.h>
142
+ #include <ATen/ops/acosh_cpu_dispatch.h>
143
+ #include <ATen/ops/adaptive_avg_pool2d_cpu_dispatch.h>
144
+ #include <ATen/ops/adaptive_avg_pool3d_cpu_dispatch.h>
145
+ #include <ATen/ops/adaptive_avg_pool3d_backward_cpu_dispatch.h>
146
+ #include <ATen/ops/adaptive_max_pool2d_cpu_dispatch.h>
147
+ #include <ATen/ops/adaptive_max_pool2d_backward_cpu_dispatch.h>
148
+ #include <ATen/ops/adaptive_max_pool3d_cpu_dispatch.h>
149
+ #include <ATen/ops/adaptive_max_pool3d_backward_cpu_dispatch.h>
150
+ #include <ATen/ops/add_cpu_dispatch.h>
151
+ #include <ATen/ops/addbmm_cpu_dispatch.h>
152
+ #include <ATen/ops/addcdiv_cpu_dispatch.h>
153
+ #include <ATen/ops/addcmul_cpu_dispatch.h>
154
+ #include <ATen/ops/addmm_cpu_dispatch.h>
155
+ #include <ATen/ops/addmv_cpu_dispatch.h>
156
+ #include <ATen/ops/addr_cpu_dispatch.h>
157
+ #include <ATen/ops/all_cpu_dispatch.h>
158
+ #include <ATen/ops/amax_cpu_dispatch.h>
159
+ #include <ATen/ops/amin_cpu_dispatch.h>
160
+ #include <ATen/ops/aminmax_cpu_dispatch.h>
161
+ #include <ATen/ops/angle_cpu_dispatch.h>
162
+ #include <ATen/ops/any_cpu_dispatch.h>
163
+ #include <ATen/ops/arange_cpu_dispatch.h>
164
+ #include <ATen/ops/argmax_cpu_dispatch.h>
165
+ #include <ATen/ops/argmin_cpu_dispatch.h>
166
+ #include <ATen/ops/as_strided_cpu_dispatch.h>
167
+ #include <ATen/ops/asin_cpu_dispatch.h>
168
+ #include <ATen/ops/asinh_cpu_dispatch.h>
169
+ #include <ATen/ops/atan_cpu_dispatch.h>
170
+ #include <ATen/ops/atan2_cpu_dispatch.h>
171
+ #include <ATen/ops/atanh_cpu_dispatch.h>
172
+ #include <ATen/ops/avg_pool2d_cpu_dispatch.h>
173
+ #include <ATen/ops/avg_pool2d_backward_cpu_dispatch.h>
174
+ #include <ATen/ops/avg_pool3d_cpu_dispatch.h>
175
+ #include <ATen/ops/avg_pool3d_backward_cpu_dispatch.h>
176
+ #include <ATen/ops/baddbmm_cpu_dispatch.h>
177
+ #include <ATen/ops/batch_norm_backward_cpu_dispatch.h>
178
+ #include <ATen/ops/batch_norm_update_stats_cpu_dispatch.h>
179
+ #include <ATen/ops/bernoulli_cpu_dispatch.h>
180
+ #include <ATen/ops/binary_cross_entropy_cpu_dispatch.h>
181
+ #include <ATen/ops/binary_cross_entropy_backward_cpu_dispatch.h>
182
+ #include <ATen/ops/bincount_cpu_dispatch.h>
183
+ #include <ATen/ops/binomial_cpu_dispatch.h>
184
+ #include <ATen/ops/bitwise_and_cpu_dispatch.h>
185
+ #include <ATen/ops/bitwise_left_shift_cpu_dispatch.h>
186
+ #include <ATen/ops/bitwise_not_cpu_dispatch.h>
187
+ #include <ATen/ops/bitwise_or_cpu_dispatch.h>
188
+ #include <ATen/ops/bitwise_right_shift_cpu_dispatch.h>
189
+ #include <ATen/ops/bitwise_xor_cpu_dispatch.h>
190
+ #include <ATen/ops/bmm_cpu_dispatch.h>
191
+ #include <ATen/ops/bucketize_cpu_dispatch.h>
192
+ #include <ATen/ops/cat_cpu_dispatch.h>
193
+ #include <ATen/ops/cauchy_cpu_dispatch.h>
194
+ #include <ATen/ops/ceil_cpu_dispatch.h>
195
+ #include <ATen/ops/channel_shuffle_cpu_dispatch.h>
196
+ #include <ATen/ops/cholesky_cpu_dispatch.h>
197
+ #include <ATen/ops/cholesky_inverse_cpu_dispatch.h>
198
+ #include <ATen/ops/clamp_cpu_dispatch.h>
199
+ #include <ATen/ops/clamp_max_cpu_dispatch.h>
200
+ #include <ATen/ops/clamp_min_cpu_dispatch.h>
201
+ #include <ATen/ops/col2im_cpu_dispatch.h>
202
+ #include <ATen/ops/complex_cpu_dispatch.h>
203
+ #include <ATen/ops/conj_physical_cpu_dispatch.h>
204
+ #include <ATen/ops/copysign_cpu_dispatch.h>
205
+ #include <ATen/ops/cos_cpu_dispatch.h>
206
+ #include <ATen/ops/cosh_cpu_dispatch.h>
207
+ #include <ATen/ops/count_nonzero_cpu_dispatch.h>
208
+ #include <ATen/ops/cumprod_cpu_dispatch.h>
209
+ #include <ATen/ops/cumsum_cpu_dispatch.h>
210
+ #include <ATen/ops/dequantize_cpu_dispatch.h>
211
+ #include <ATen/ops/digamma_cpu_dispatch.h>
212
+ #include <ATen/ops/div_cpu_dispatch.h>
213
+ #include <ATen/ops/dot_cpu_dispatch.h>
214
+ #include <ATen/ops/elu_cpu_dispatch.h>
215
+ #include <ATen/ops/elu_backward_cpu_dispatch.h>
216
+ #include <ATen/ops/embedding_dense_backward_cpu_dispatch.h>
217
+ #include <ATen/ops/embedding_renorm_cpu_dispatch.h>
218
+ #include <ATen/ops/empty_cpu_dispatch.h>
219
+ #include <ATen/ops/empty_strided_cpu_dispatch.h>
220
+ #include <ATen/ops/eq_cpu_dispatch.h>
221
+ #include <ATen/ops/equal_cpu_dispatch.h>
222
+ #include <ATen/ops/erf_cpu_dispatch.h>
223
+ #include <ATen/ops/erfc_cpu_dispatch.h>
224
+ #include <ATen/ops/erfinv_cpu_dispatch.h>
225
+ #include <ATen/ops/exp_cpu_dispatch.h>
226
+ #include <ATen/ops/exp2_cpu_dispatch.h>
227
+ #include <ATen/ops/expm1_cpu_dispatch.h>
228
+ #include <ATen/ops/exponential_cpu_dispatch.h>
229
+ #include <ATen/ops/eye_cpu_dispatch.h>
230
+ #include <ATen/ops/fake_quantize_per_channel_affine_cachemask_cpu_dispatch.h>
231
+ #include <ATen/ops/fake_quantize_per_tensor_affine_cachemask_cpu_dispatch.h>
232
+ #include <ATen/ops/fill_cpu_dispatch.h>
233
+ #include <ATen/ops/flip_cpu_dispatch.h>
234
+ #include <ATen/ops/floor_cpu_dispatch.h>
235
+ #include <ATen/ops/floor_divide_cpu_dispatch.h>
236
+ #include <ATen/ops/fmax_cpu_dispatch.h>
237
+ #include <ATen/ops/fmin_cpu_dispatch.h>
238
+ #include <ATen/ops/fmod_cpu_dispatch.h>
239
+ #include <ATen/ops/frac_cpu_dispatch.h>
240
+ #include <ATen/ops/fractional_max_pool2d_cpu_dispatch.h>
241
+ #include <ATen/ops/fractional_max_pool2d_backward_cpu_dispatch.h>
242
+ #include <ATen/ops/fractional_max_pool3d_cpu_dispatch.h>
243
+ #include <ATen/ops/fractional_max_pool3d_backward_cpu_dispatch.h>
244
+ #include <ATen/ops/frexp_cpu_dispatch.h>
245
+ #include <ATen/ops/from_file_cpu_dispatch.h>
246
+ #include <ATen/ops/gather_cpu_dispatch.h>
247
+ #include <ATen/ops/gcd_cpu_dispatch.h>
248
+ #include <ATen/ops/ge_cpu_dispatch.h>
249
+ #include <ATen/ops/gelu_cpu_dispatch.h>
250
+ #include <ATen/ops/gelu_backward_cpu_dispatch.h>
251
+ #include <ATen/ops/geometric_cpu_dispatch.h>
252
+ #include <ATen/ops/geqrf_cpu_dispatch.h>
253
+ #include <ATen/ops/glu_cpu_dispatch.h>
254
+ #include <ATen/ops/glu_backward_cpu_dispatch.h>
255
+ #include <ATen/ops/glu_backward_jvp_cpu_dispatch.h>
256
+ #include <ATen/ops/glu_jvp_cpu_dispatch.h>
257
+ #include <ATen/ops/grid_sampler_2d_cpu_dispatch.h>
258
+ #include <ATen/ops/grid_sampler_2d_backward_cpu_dispatch.h>
259
+ #include <ATen/ops/grid_sampler_3d_cpu_dispatch.h>
260
+ #include <ATen/ops/grid_sampler_3d_backward_cpu_dispatch.h>
261
+ #include <ATen/ops/gt_cpu_dispatch.h>
262
+ #include <ATen/ops/hardshrink_cpu_dispatch.h>
263
+ #include <ATen/ops/hardshrink_backward_cpu_dispatch.h>
264
+ #include <ATen/ops/hardsigmoid_cpu_dispatch.h>
265
+ #include <ATen/ops/hardsigmoid_backward_cpu_dispatch.h>
266
+ #include <ATen/ops/hardswish_cpu_dispatch.h>
267
+ #include <ATen/ops/hardswish_backward_cpu_dispatch.h>
268
+ #include <ATen/ops/hardtanh_cpu_dispatch.h>
269
+ #include <ATen/ops/hardtanh_backward_cpu_dispatch.h>
270
+ #include <ATen/ops/heaviside_cpu_dispatch.h>
271
+ #include <ATen/ops/histc_cpu_dispatch.h>
272
+ #include <ATen/ops/histogram_cpu_dispatch.h>
273
+ #include <ATen/ops/huber_loss_cpu_dispatch.h>
274
+ #include <ATen/ops/huber_loss_backward_cpu_dispatch.h>
275
+ #include <ATen/ops/hypot_cpu_dispatch.h>
276
+ #include <ATen/ops/i0_cpu_dispatch.h>
277
+ #include <ATen/ops/igamma_cpu_dispatch.h>
278
+ #include <ATen/ops/igammac_cpu_dispatch.h>
279
+ #include <ATen/ops/im2col_cpu_dispatch.h>
280
+ #include <ATen/ops/index_cpu_dispatch.h>
281
+ #include <ATen/ops/index_add_cpu_dispatch.h>
282
+ #include <ATen/ops/index_copy_cpu_dispatch.h>
283
+ #include <ATen/ops/index_fill_cpu_dispatch.h>
284
+ #include <ATen/ops/index_reduce_cpu_dispatch.h>
285
+ #include <ATen/ops/index_select_cpu_dispatch.h>
286
+ #include <ATen/ops/is_set_to_cpu_dispatch.h>
287
+ #include <ATen/ops/isin_cpu_dispatch.h>
288
+ #include <ATen/ops/isnan_cpu_dispatch.h>
289
+ #include <ATen/ops/isneginf_cpu_dispatch.h>
290
+ #include <ATen/ops/isposinf_cpu_dispatch.h>
291
+ #include <ATen/ops/kthvalue_cpu_dispatch.h>
292
+ #include <ATen/ops/lcm_cpu_dispatch.h>
293
+ #include <ATen/ops/le_cpu_dispatch.h>
294
+ #include <ATen/ops/leaky_relu_cpu_dispatch.h>
295
+ #include <ATen/ops/leaky_relu_backward_cpu_dispatch.h>
296
+ #include <ATen/ops/lerp_cpu_dispatch.h>
297
+ #include <ATen/ops/lgamma_cpu_dispatch.h>
298
+ #include <ATen/ops/linalg_cholesky_ex_cpu_dispatch.h>
299
+ #include <ATen/ops/linalg_cross_cpu_dispatch.h>
300
+ #include <ATen/ops/linalg_eig_cpu_dispatch.h>
301
+ #include <ATen/ops/linalg_eigvals_cpu_dispatch.h>
302
+ #include <ATen/ops/linalg_householder_product_cpu_dispatch.h>
303
+ #include <ATen/ops/linalg_inv_ex_cpu_dispatch.h>
304
+ #include <ATen/ops/linalg_ldl_factor_ex_cpu_dispatch.h>
305
+ #include <ATen/ops/linalg_ldl_solve_cpu_dispatch.h>
306
+ #include <ATen/ops/linalg_lstsq_cpu_dispatch.h>
307
+ #include <ATen/ops/linalg_lu_cpu_dispatch.h>
308
+ #include <ATen/ops/linalg_lu_factor_ex_cpu_dispatch.h>
309
+ #include <ATen/ops/linalg_lu_solve_cpu_dispatch.h>
310
+ #include <ATen/ops/linalg_matrix_exp_cpu_dispatch.h>
311
+ #include <ATen/ops/linalg_qr_cpu_dispatch.h>
312
+ #include <ATen/ops/linalg_solve_triangular_cpu_dispatch.h>
313
+ #include <ATen/ops/linalg_vector_norm_cpu_dispatch.h>
314
+ #include <ATen/ops/linspace_cpu_dispatch.h>
315
+ #include <ATen/ops/log_cpu_dispatch.h>
316
+ #include <ATen/ops/log10_cpu_dispatch.h>
317
+ #include <ATen/ops/log1p_cpu_dispatch.h>
318
+ #include <ATen/ops/log2_cpu_dispatch.h>
319
+ #include <ATen/ops/log_normal_cpu_dispatch.h>
320
+ #include <ATen/ops/log_sigmoid_backward_cpu_dispatch.h>
321
+ #include <ATen/ops/log_sigmoid_forward_cpu_dispatch.h>
322
+ #include <ATen/ops/logaddexp_cpu_dispatch.h>
323
+ #include <ATen/ops/logaddexp2_cpu_dispatch.h>
324
+ #include <ATen/ops/logical_and_cpu_dispatch.h>
325
+ #include <ATen/ops/logical_not_cpu_dispatch.h>
326
+ #include <ATen/ops/logical_or_cpu_dispatch.h>
327
+ #include <ATen/ops/logical_xor_cpu_dispatch.h>
328
+ #include <ATen/ops/logit_cpu_dispatch.h>
329
+ #include <ATen/ops/logit_backward_cpu_dispatch.h>
330
+ #include <ATen/ops/logspace_cpu_dispatch.h>
331
+ #include <ATen/ops/lshift_cpu_dispatch.h>
332
+ #include <ATen/ops/lt_cpu_dispatch.h>
333
+ #include <ATen/ops/lu_unpack_cpu_dispatch.h>
334
+ #include <ATen/ops/masked_fill_cpu_dispatch.h>
335
+ #include <ATen/ops/masked_scatter_cpu_dispatch.h>
336
+ #include <ATen/ops/masked_select_cpu_dispatch.h>
337
+ #include <ATen/ops/max_cpu_dispatch.h>
338
+ #include <ATen/ops/max_pool2d_with_indices_cpu_dispatch.h>
339
+ #include <ATen/ops/max_pool2d_with_indices_backward_cpu_dispatch.h>
340
+ #include <ATen/ops/max_pool3d_with_indices_cpu_dispatch.h>
341
+ #include <ATen/ops/max_pool3d_with_indices_backward_cpu_dispatch.h>
342
+ #include <ATen/ops/max_unpool2d_cpu_dispatch.h>
343
+ #include <ATen/ops/max_unpool3d_cpu_dispatch.h>
344
+ #include <ATen/ops/maximum_cpu_dispatch.h>
345
+ #include <ATen/ops/mean_cpu_dispatch.h>
346
+ #include <ATen/ops/median_cpu_dispatch.h>
347
+ #include <ATen/ops/min_cpu_dispatch.h>
348
+ #include <ATen/ops/minimum_cpu_dispatch.h>
349
+ #include <ATen/ops/mish_cpu_dispatch.h>
350
+ #include <ATen/ops/mish_backward_cpu_dispatch.h>
351
+ #include <ATen/ops/mkldnn_rnn_layer_cpu_dispatch.h>
352
+ #include <ATen/ops/mkldnn_rnn_layer_backward_cpu_dispatch.h>
353
+ #include <ATen/ops/mm_cpu_dispatch.h>
354
+ #include <ATen/ops/mode_cpu_dispatch.h>
355
+ #include <ATen/ops/mse_loss_cpu_dispatch.h>
356
+ #include <ATen/ops/mse_loss_backward_cpu_dispatch.h>
357
+ #include <ATen/ops/mul_cpu_dispatch.h>
358
+ #include <ATen/ops/multi_margin_loss_cpu_dispatch.h>
359
+ #include <ATen/ops/multi_margin_loss_backward_cpu_dispatch.h>
360
+ #include <ATen/ops/multilabel_margin_loss_backward_cpu_dispatch.h>
361
+ #include <ATen/ops/multilabel_margin_loss_forward_cpu_dispatch.h>
362
+ #include <ATen/ops/multinomial_cpu_dispatch.h>
363
+ #include <ATen/ops/mvlgamma_cpu_dispatch.h>
364
+ #include <ATen/ops/nan_to_num_cpu_dispatch.h>
365
+ #include <ATen/ops/nanmedian_cpu_dispatch.h>
366
+ #include <ATen/ops/nansum_cpu_dispatch.h>
367
+ #include <ATen/ops/narrow_copy_cpu_dispatch.h>
368
+ #include <ATen/ops/native_batch_norm_cpu_dispatch.h>
369
+ #include <ATen/ops/native_batch_norm_backward_cpu_dispatch.h>
370
+ #include <ATen/ops/native_channel_shuffle_cpu_dispatch.h>
371
+ #include <ATen/ops/native_dropout_cpu_dispatch.h>
372
+ #include <ATen/ops/native_dropout_backward_cpu_dispatch.h>
373
+ #include <ATen/ops/native_group_norm_cpu_dispatch.h>
374
+ #include <ATen/ops/native_group_norm_backward_cpu_dispatch.h>
375
+ #include <ATen/ops/native_layer_norm_cpu_dispatch.h>
376
+ #include <ATen/ops/native_layer_norm_backward_cpu_dispatch.h>
377
+ #include <ATen/ops/ne_cpu_dispatch.h>
378
+ #include <ATen/ops/neg_cpu_dispatch.h>
379
+ #include <ATen/ops/nextafter_cpu_dispatch.h>
380
+ #include <ATen/ops/nll_loss2d_backward_cpu_dispatch.h>
381
+ #include <ATen/ops/nll_loss2d_forward_cpu_dispatch.h>
382
+ #include <ATen/ops/nll_loss_backward_cpu_dispatch.h>
383
+ #include <ATen/ops/nll_loss_forward_cpu_dispatch.h>
384
+ #include <ATen/ops/nonzero_cpu_dispatch.h>
385
+ #include <ATen/ops/nonzero_static_cpu_dispatch.h>
386
+ #include <ATen/ops/norm_cpu_dispatch.h>
387
+ #include <ATen/ops/normal_cpu_dispatch.h>
388
+ #include <ATen/ops/ormqr_cpu_dispatch.h>
389
+ #include <ATen/ops/pixel_shuffle_cpu_dispatch.h>
390
+ #include <ATen/ops/pixel_unshuffle_cpu_dispatch.h>
391
+ #include <ATen/ops/poisson_cpu_dispatch.h>
392
+ #include <ATen/ops/polar_cpu_dispatch.h>
393
+ #include <ATen/ops/polygamma_cpu_dispatch.h>
394
+ #include <ATen/ops/pow_cpu_dispatch.h>
395
+ #include <ATen/ops/prod_cpu_dispatch.h>
396
+ #include <ATen/ops/put_cpu_dispatch.h>
397
+ #include <ATen/ops/quantize_per_channel_cpu_dispatch.h>
398
+ #include <ATen/ops/quantize_per_tensor_cpu_dispatch.h>
399
+ #include <ATen/ops/quantize_per_tensor_dynamic_cpu_dispatch.h>
400
+ #include <ATen/ops/random_cpu_dispatch.h>
401
+ #include <ATen/ops/randperm_cpu_dispatch.h>
402
+ #include <ATen/ops/range_cpu_dispatch.h>
403
+ #include <ATen/ops/reciprocal_cpu_dispatch.h>
404
+ #include <ATen/ops/reflection_pad1d_cpu_dispatch.h>
405
+ #include <ATen/ops/reflection_pad1d_backward_cpu_dispatch.h>
406
+ #include <ATen/ops/reflection_pad2d_cpu_dispatch.h>
407
+ #include <ATen/ops/reflection_pad2d_backward_cpu_dispatch.h>
408
+ #include <ATen/ops/reflection_pad3d_cpu_dispatch.h>
409
+ #include <ATen/ops/reflection_pad3d_backward_cpu_dispatch.h>
410
+ #include <ATen/ops/relu_cpu_dispatch.h>
411
+ #include <ATen/ops/remainder_cpu_dispatch.h>
412
+ #include <ATen/ops/renorm_cpu_dispatch.h>
413
+ #include <ATen/ops/repeat_interleave_cpu_dispatch.h>
414
+ #include <ATen/ops/replication_pad1d_cpu_dispatch.h>
415
+ #include <ATen/ops/replication_pad1d_backward_cpu_dispatch.h>
416
+ #include <ATen/ops/replication_pad2d_cpu_dispatch.h>
417
+ #include <ATen/ops/replication_pad2d_backward_cpu_dispatch.h>
418
+ #include <ATen/ops/replication_pad3d_cpu_dispatch.h>
419
+ #include <ATen/ops/replication_pad3d_backward_cpu_dispatch.h>
420
+ #include <ATen/ops/resize_cpu_dispatch.h>
421
+ #include <ATen/ops/roll_cpu_dispatch.h>
422
+ #include <ATen/ops/round_cpu_dispatch.h>
423
+ #include <ATen/ops/rrelu_with_noise_cpu_dispatch.h>
424
+ #include <ATen/ops/rshift_cpu_dispatch.h>
425
+ #include <ATen/ops/rsqrt_cpu_dispatch.h>
426
+ #include <ATen/ops/rsub_cpu_dispatch.h>
427
+ #include <ATen/ops/scatter_cpu_dispatch.h>
428
+ #include <ATen/ops/scatter_add_cpu_dispatch.h>
429
+ #include <ATen/ops/scatter_reduce_cpu_dispatch.h>
430
+ #include <ATen/ops/searchsorted_cpu_dispatch.h>
431
+ #include <ATen/ops/segment_reduce_cpu_dispatch.h>
432
+ #include <ATen/ops/set_cpu_dispatch.h>
433
+ #include <ATen/ops/sgn_cpu_dispatch.h>
434
+ #include <ATen/ops/sigmoid_cpu_dispatch.h>
435
+ #include <ATen/ops/sigmoid_backward_cpu_dispatch.h>
436
+ #include <ATen/ops/sign_cpu_dispatch.h>
437
+ #include <ATen/ops/signbit_cpu_dispatch.h>
438
+ #include <ATen/ops/silu_cpu_dispatch.h>
439
+ #include <ATen/ops/silu_backward_cpu_dispatch.h>
440
+ #include <ATen/ops/sin_cpu_dispatch.h>
441
+ #include <ATen/ops/sinc_cpu_dispatch.h>
442
+ #include <ATen/ops/sinh_cpu_dispatch.h>
443
+ #include <ATen/ops/slow_conv3d_forward_cpu_dispatch.h>
444
+ #include <ATen/ops/slow_conv_dilated2d_cpu_dispatch.h>
445
+ #include <ATen/ops/slow_conv_dilated3d_cpu_dispatch.h>
446
+ #include <ATen/ops/slow_conv_transpose2d_cpu_dispatch.h>
447
+ #include <ATen/ops/slow_conv_transpose3d_cpu_dispatch.h>
448
+ #include <ATen/ops/smooth_l1_loss_cpu_dispatch.h>
449
+ #include <ATen/ops/smooth_l1_loss_backward_cpu_dispatch.h>
450
+ #include <ATen/ops/softplus_cpu_dispatch.h>
451
+ #include <ATen/ops/softplus_backward_cpu_dispatch.h>
452
+ #include <ATen/ops/softshrink_cpu_dispatch.h>
453
+ #include <ATen/ops/softshrink_backward_cpu_dispatch.h>
454
+ #include <ATen/ops/sort_cpu_dispatch.h>
455
+ #include <ATen/ops/special_airy_ai_cpu_dispatch.h>
456
+ #include <ATen/ops/special_bessel_j0_cpu_dispatch.h>
457
+ #include <ATen/ops/special_bessel_j1_cpu_dispatch.h>
458
+ #include <ATen/ops/special_bessel_y0_cpu_dispatch.h>
459
+ #include <ATen/ops/special_bessel_y1_cpu_dispatch.h>
460
+ #include <ATen/ops/special_chebyshev_polynomial_t_cpu_dispatch.h>
461
+ #include <ATen/ops/special_chebyshev_polynomial_u_cpu_dispatch.h>
462
+ #include <ATen/ops/special_chebyshev_polynomial_v_cpu_dispatch.h>
463
+ #include <ATen/ops/special_chebyshev_polynomial_w_cpu_dispatch.h>
464
+ #include <ATen/ops/special_entr_cpu_dispatch.h>
465
+ #include <ATen/ops/special_erfcx_cpu_dispatch.h>
466
+ #include <ATen/ops/special_hermite_polynomial_h_cpu_dispatch.h>
467
+ #include <ATen/ops/special_hermite_polynomial_he_cpu_dispatch.h>
468
+ #include <ATen/ops/special_i0e_cpu_dispatch.h>
469
+ #include <ATen/ops/special_i1_cpu_dispatch.h>
470
+ #include <ATen/ops/special_i1e_cpu_dispatch.h>
471
+ #include <ATen/ops/special_laguerre_polynomial_l_cpu_dispatch.h>
472
+ #include <ATen/ops/special_legendre_polynomial_p_cpu_dispatch.h>
473
+ #include <ATen/ops/special_log_ndtr_cpu_dispatch.h>
474
+ #include <ATen/ops/special_modified_bessel_i0_cpu_dispatch.h>
475
+ #include <ATen/ops/special_modified_bessel_i1_cpu_dispatch.h>
476
+ #include <ATen/ops/special_modified_bessel_k0_cpu_dispatch.h>
477
+ #include <ATen/ops/special_modified_bessel_k1_cpu_dispatch.h>
478
+ #include <ATen/ops/special_ndtri_cpu_dispatch.h>
479
+ #include <ATen/ops/special_scaled_modified_bessel_k0_cpu_dispatch.h>
480
+ #include <ATen/ops/special_scaled_modified_bessel_k1_cpu_dispatch.h>
481
+ #include <ATen/ops/special_shifted_chebyshev_polynomial_t_cpu_dispatch.h>
482
+ #include <ATen/ops/special_shifted_chebyshev_polynomial_u_cpu_dispatch.h>
483
+ #include <ATen/ops/special_shifted_chebyshev_polynomial_v_cpu_dispatch.h>
484
+ #include <ATen/ops/special_shifted_chebyshev_polynomial_w_cpu_dispatch.h>
485
+ #include <ATen/ops/special_spherical_bessel_j0_cpu_dispatch.h>
486
+ #include <ATen/ops/special_xlog1py_cpu_dispatch.h>
487
+ #include <ATen/ops/special_zeta_cpu_dispatch.h>
488
+ #include <ATen/ops/sqrt_cpu_dispatch.h>
489
+ #include <ATen/ops/sspaddmm_cpu_dispatch.h>
490
+ #include <ATen/ops/std_cpu_dispatch.h>
491
+ #include <ATen/ops/std_mean_cpu_dispatch.h>
492
+ #include <ATen/ops/sub_cpu_dispatch.h>
493
+ #include <ATen/ops/sum_cpu_dispatch.h>
494
+ #include <ATen/ops/take_cpu_dispatch.h>
495
+ #include <ATen/ops/tan_cpu_dispatch.h>
496
+ #include <ATen/ops/tanh_cpu_dispatch.h>
497
+ #include <ATen/ops/tanh_backward_cpu_dispatch.h>
498
+ #include <ATen/ops/threshold_cpu_dispatch.h>
499
+ #include <ATen/ops/threshold_backward_cpu_dispatch.h>
500
+ #include <ATen/ops/to_mkldnn_cpu_dispatch.h>
501
+ #include <ATen/ops/topk_cpu_dispatch.h>
502
+ #include <ATen/ops/trace_cpu_dispatch.h>
503
+ #include <ATen/ops/triangular_solve_cpu_dispatch.h>
504
+ #include <ATen/ops/tril_cpu_dispatch.h>
505
+ #include <ATen/ops/tril_indices_cpu_dispatch.h>
506
+ #include <ATen/ops/triu_cpu_dispatch.h>
507
+ #include <ATen/ops/triu_indices_cpu_dispatch.h>
508
+ #include <ATen/ops/trunc_cpu_dispatch.h>
509
+ #include <ATen/ops/unfold_cpu_dispatch.h>
510
+ #include <ATen/ops/unfold_backward_cpu_dispatch.h>
511
+ #include <ATen/ops/uniform_cpu_dispatch.h>
512
+ #include <ATen/ops/unique_consecutive_cpu_dispatch.h>
513
+ #include <ATen/ops/unique_dim_cpu_dispatch.h>
514
+ #include <ATen/ops/unique_dim_consecutive_cpu_dispatch.h>
515
+ #include <ATen/ops/upsample_bicubic2d_cpu_dispatch.h>
516
+ #include <ATen/ops/upsample_bicubic2d_backward_cpu_dispatch.h>
517
+ #include <ATen/ops/upsample_bilinear2d_cpu_dispatch.h>
518
+ #include <ATen/ops/upsample_bilinear2d_backward_cpu_dispatch.h>
519
+ #include <ATen/ops/upsample_linear1d_cpu_dispatch.h>
520
+ #include <ATen/ops/upsample_linear1d_backward_cpu_dispatch.h>
521
+ #include <ATen/ops/upsample_nearest1d_cpu_dispatch.h>
522
+ #include <ATen/ops/upsample_nearest1d_backward_cpu_dispatch.h>
523
+ #include <ATen/ops/upsample_nearest2d_cpu_dispatch.h>
524
+ #include <ATen/ops/upsample_nearest2d_backward_cpu_dispatch.h>
525
+ #include <ATen/ops/upsample_nearest3d_cpu_dispatch.h>
526
+ #include <ATen/ops/upsample_nearest3d_backward_cpu_dispatch.h>
527
+ #include <ATen/ops/upsample_trilinear3d_cpu_dispatch.h>
528
+ #include <ATen/ops/upsample_trilinear3d_backward_cpu_dispatch.h>
529
+ #include <ATen/ops/var_cpu_dispatch.h>
530
+ #include <ATen/ops/var_mean_cpu_dispatch.h>
531
+ #include <ATen/ops/vdot_cpu_dispatch.h>
532
+ #include <ATen/ops/view_cpu_dispatch.h>
533
+ #include <ATen/ops/view_as_complex_cpu_dispatch.h>
534
+ #include <ATen/ops/view_as_real_cpu_dispatch.h>
535
+ #include <ATen/ops/where_cpu_dispatch.h>
536
+ #include <ATen/ops/xlogy_cpu_dispatch.h>
537
+ #include <ATen/ops/zero_cpu_dispatch.h>
538
+
539
+
540
+
lib/python3.11/site-packages/torch/include/ATen/CPUGeneratorImpl.h ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <ATen/core/Generator.h>
4
+ #include <ATen/core/MT19937RNGEngine.h>
5
+ #include <c10/core/GeneratorImpl.h>
6
+ #include <optional>
7
+
8
+ namespace at {
9
+
10
+ struct TORCH_API CPUGeneratorImpl : public c10::GeneratorImpl {
11
+ // Constructors
12
+ CPUGeneratorImpl(uint64_t seed_in = default_rng_seed_val);
13
+ ~CPUGeneratorImpl() override = default;
14
+
15
+ // CPUGeneratorImpl methods
16
+ std::shared_ptr<CPUGeneratorImpl> clone() const;
17
+ void set_current_seed(uint64_t seed) override;
18
+ void set_offset(uint64_t offset) override;
19
+ uint64_t get_offset() const override;
20
+ uint64_t current_seed() const override;
21
+ uint64_t seed() override;
22
+ void set_state(const c10::TensorImpl& new_state) override;
23
+ c10::intrusive_ptr<c10::TensorImpl> get_state() const override;
24
+ static c10::DeviceType device_type();
25
+ uint32_t random();
26
+ uint64_t random64();
27
+ std::optional<float> next_float_normal_sample();
28
+ std::optional<double> next_double_normal_sample();
29
+ void set_next_float_normal_sample(std::optional<float> randn);
30
+ void set_next_double_normal_sample(std::optional<double> randn);
31
+ at::mt19937 engine();
32
+ void set_engine(at::mt19937 engine);
33
+
34
+ private:
35
+ CPUGeneratorImpl* clone_impl() const override;
36
+ at::mt19937 engine_;
37
+ std::optional<float> next_float_normal_sample_;
38
+ std::optional<double> next_double_normal_sample_;
39
+ };
40
+
41
+ namespace detail {
42
+
43
+ TORCH_API const Generator& getDefaultCPUGenerator();
44
+ TORCH_API Generator
45
+ createCPUGenerator(uint64_t seed_val = default_rng_seed_val);
46
+
47
+ } // namespace detail
48
+
49
+ } // namespace at
lib/python3.11/site-packages/torch/include/ATen/CUDAFunctions.h ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <ATen/core/TensorBody.h>
2
+
3
+ // TODO Undo all logic introduced for Note [Avoiding Include Cycles In Static Dispatch]
4
+ // Code introduced to avoid cyclic dependency in static dispatch is no longer
5
+ // needed as static dispatch logic is moved from TensorBody.h, which caused cycles in the first place,
6
+ // to Operators.cpp for supporting multiple backends with multiple kernels.
7
+ //
8
+ // Note [Avoiding Include Cycles In Static Dispatch]
9
+ // In order to avoid #include cycles in the static dispatch build, we've carefully split out
10
+ // the static function definition files into {DispatchKey}Functions.h and {DispatchKey}Functions_inl.h.
11
+ //
12
+ // Without this split, the include cycle looks like TensorBody.h -> CPUFunctions.h -> TensorBody.h.
13
+ // - TensorBody.h #includes CPUFunctions.h in the static dispatch build, because the tensor methods
14
+ // all need to call into the fastpath C++ API defined in CPUFunctions.h. The methods are also all
15
+ // directly inlined into TensorBody.h.
16
+ // - CPUFunctions.h #includes TensorBody.h because it contains function declarations for the entire C++ API,
17
+ // which include functions that have defaultable std::optional<Tensor> arguments.
18
+ // That requires knowing the full Tensor class definition.
19
+ //
20
+ // We break the cycle by doing the following:
21
+ // - Split out CPUFunction.h into two files: CPUFunctions.h and CPUFunctions_inl.h
22
+ // - CPUFunction.h is a dummy file that just includes the Tensor class and includes CPUFunctions_inl.,
23
+ // - CPUFunctions_inl.h includes everything else
24
+ // - (only in the static dispatch build) TensorBody.h makes sure to finish defining the Tensor class,
25
+ // and then it includes CPUFunctions_inl.h.
26
+ // - All other files that want the cpu fastpath functions can include CPUFunctions.h directly.
27
+ // - This also means that static dispatch build, CPUFunctions.h only needs to
28
+ // #include TensorBody.h, and it will automatically bring in CPUFunctions_inl.h.
29
+ #include <ATen/CUDAFunctions_inl.h>