Skip to content

Commit c409ae7

Browse files
committed
Update on "Delete NativeFunctions.h include from Functions.h"
Only one header needed to be updated to now include NativeFunctions.h Signed-off-by: Edward Z. Yang <ezyang@fb.com> [ghstack-poisoned]
1 parent 616e965 commit c409ae7

2 files changed

Lines changed: 23 additions & 23 deletions

File tree

aten/src/ATen/templates/Functions.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,29 @@
1818

1919
namespace 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)

aten/src/ATen/templates/NativeFunctions.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,6 @@ struct Type;
2323
} // namespace at
2424

2525
namespace 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-
4926
namespace native {
5027

5128
${native_function_declarations}

0 commit comments

Comments
 (0)