#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION) #pragma once #include #include namespace at { // These functions are defined in ATen/Utils.cpp. #define TENSOR(T, S) \ TORCH_API Tensor tensor(ArrayRef values, const TensorOptions& options); \ inline Tensor tensor( \ std::initializer_list values, const TensorOptions& options) { \ return at::tensor(ArrayRef(values), options); \ } \ inline Tensor tensor(T value, const TensorOptions& options) { \ return at::tensor(ArrayRef(value), options); \ } \ inline Tensor tensor(ArrayRef values) { \ return at::tensor(std::move(values), at::dtype(k##S)); \ } \ inline Tensor tensor(std::initializer_list values) { \ return at::tensor(ArrayRef(values)); \ } \ inline Tensor tensor(T value) { \ return at::tensor(ArrayRef(value)); \ } AT_FORALL_SCALAR_TYPES_AND3(Bool, Half, BFloat16, TENSOR) AT_FORALL_COMPLEX_TYPES(TENSOR) #undef TENSOR } // namespace at #else #error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined." #endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)