3 #include <torch/csrc/utils/variadic.h> 4 #include <torch/types.h> 35 static yes
test(decltype(&U::forward));
41 static constexpr
bool value = (
sizeof(test<T>(
nullptr)) ==
sizeof(yes));
44 template <
typename Head = void,
typename... Tail>
45 constexpr
bool check_not_lvalue_references() {
46 return (!std::is_lvalue_reference<Head>::value ||
47 std::is_const<
typename std::remove_reference<Head>::type>::value) &&
48 check_not_lvalue_references<Tail...>();
52 inline constexpr
bool check_not_lvalue_references<void>() {
59 std::is_base_of<torch::nn::Module, typename std::decay<M>::type>;
61 template <
typename M,
typename T =
void>
62 using enable_if_module_t =
63 typename std::enable_if<is_module<M>::value,
T>::type;
Detects if a type T has a forward() method.