#if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION) #pragma once #ifndef C10_UTIL_CPP17_H_ #define C10_UTIL_CPP17_H_ #include #include #include namespace c10::guts { #if defined(__HIP__) // std::apply is not available in HIP device code because it lacks // __host__ __device__ annotations in the standard library. namespace detail { template C10_HOST_DEVICE constexpr auto apply_impl( F&& f, Tuple&& t, std::index_sequence) { return std::forward(f)(std::get(std::forward(t))...); } } // namespace detail template C10_HOST_DEVICE constexpr auto apply(F&& f, Tuple&& t) { return detail::apply_impl( std::forward(f), std::forward(t), std::make_index_sequence< std::tuple_size>::value>{}); } #endif } // namespace c10::guts #endif // C10_UTIL_CPP17_H_ #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)