#pragma once #include namespace c10 { namespace detail { // WrapKernelFunction: Wraps a compile time function pointer into a kernel functor. // Since it is a compile time function pointer, many compilers can inline it // into the wrapper and you don't get any performance overhead for wrapping. template class WrapKernelFunction_ {}; template class WrapKernelFunction_> final : public c10::OperatorKernel { public: auto operator()(Parameters... args) -> decltype((*kernel_func)(std::forward(args)...)) { return (*kernel_func)(std::forward(args)...); } }; template::value>> struct WrapKernelFunction final { using type = WrapKernelFunction_< FuncType, kernel_func, typename guts::function_traits::return_type, typename guts::function_traits::parameter_types >; }; } }