mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
# Summary Adds a public method to dispatchstub to check if a fn has been registered for a device. We use this new function to clean up the dispatching logic for SDPA, as well as make the private use dispatching simpler: #126392 Pull Request resolved: https://github.com/pytorch/pytorch/pull/126832 Approved by: https://github.com/ezyang, https://github.com/albanD
19 lines
450 B
C++
19 lines
450 B
C++
#pragma once
|
|
|
|
#include <array>
|
|
#include <utility>
|
|
|
|
namespace c10 {
|
|
|
|
// This helper function creates a constexpr std::array
|
|
// From a compile time list of values, without requiring you to explicitly
|
|
// write out the length.
|
|
//
|
|
// See also https://stackoverflow.com/a/26351760/23845
|
|
template <typename V, typename... T>
|
|
inline constexpr auto array_of(T&&... t) -> std::array<V, sizeof...(T)> {
|
|
return {{std::forward<T>(t)...}};
|
|
}
|
|
|
|
} // namespace c10
|