File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818
1919namespace at {
2020
21+ // These functions are defined in ATen/Utils.cpp.
22+ #define TENSOR (T, S ) \
23+ CAFFE2_API Tensor tensor (ArrayRef<T> values, const TensorOptions& options); \
24+ inline Tensor tensor ( \
25+ std::initializer_list<T> values, const TensorOptions& options) { \
26+ return at::tensor (ArrayRef<T>(values), options); \
27+ } \
28+ inline Tensor tensor (T value, const TensorOptions& options) { \
29+ return at::tensor (ArrayRef<T>(value), options); \
30+ } \
31+ inline Tensor tensor (ArrayRef<T> values) { \
32+ return at::tensor (std::move (values), at::dtype (k##S)); \
33+ } \
34+ inline Tensor tensor (std::initializer_list<T> values) { \
35+ return at::tensor (ArrayRef<T>(values)); \
36+ } \
37+ inline Tensor tensor (T value) { \
38+ return at::tensor (ArrayRef<T>(value)); \
39+ }
40+ AT_FORALL_SCALAR_TYPES_AND3 (Bool, Half, BFloat16, TENSOR)
41+ AT_FORALL_COMPLEX_TYPES (TENSOR)
42+ #undef TENSOR
43+
2144${function_declarations}
2245
2346// Special C++ only overloads for std()-like functions (See gh-40287)
Original file line number Diff line number Diff line change @@ -23,29 +23,6 @@ struct Type;
2323} // namespace at
2424
2525namespace at {
26- // These functions are defined in ATen/Utils.cpp.
27- #define TENSOR (T, S ) \
28- CAFFE2_API Tensor tensor (ArrayRef<T> values, const TensorOptions& options); \
29- inline Tensor tensor ( \
30- std::initializer_list<T> values, const TensorOptions& options) { \
31- return at::tensor (ArrayRef<T>(values), options); \
32- } \
33- inline Tensor tensor (T value, const TensorOptions& options) { \
34- return at::tensor (ArrayRef<T>(value), options); \
35- } \
36- inline Tensor tensor (ArrayRef<T> values) { \
37- return at::tensor (std::move (values), at::dtype (k##S)); \
38- } \
39- inline Tensor tensor (std::initializer_list<T> values) { \
40- return at::tensor (ArrayRef<T>(values)); \
41- } \
42- inline Tensor tensor (T value) { \
43- return at::tensor (ArrayRef<T>(value)); \
44- }
45- AT_FORALL_SCALAR_TYPES_AND3 (Bool, Half, BFloat16, TENSOR)
46- AT_FORALL_COMPLEX_TYPES (TENSOR)
47- #undef TENSOR
48-
4926namespace native {
5027
5128${native_function_declarations}
You can’t perform that action at this time.
0 commit comments