Rate this Page

Template Function torch::dispatch(c10::DispatchKey, Func&&)#

Function Documentation#

template<typename Func>
inline CppFunction torch::dispatch(c10::DispatchKey k, Func &&raw_f)#

Create a torch::CppFunction which is associated with a specific dispatch key.

torch::CppFunctions that are tagged with a c10::DispatchKey don’t get invoked unless the dispatcher determines that this particular c10::DispatchKey is the one that should be dispatched to.

This function is generally not used directly, instead, prefer using TORCH_LIBRARY_IMPL(), which will implicitly set the c10::DispatchKey for all registration calls inside of its body.