Define _TORCH_LIBRARY_FRAGMENT#
Defined in File library.h
Define Documentation#
-
_TORCH_LIBRARY_FRAGMENT(ns, m, uid)
static void C10_CONCATENATE( \
TORCH_LIBRARY_FRAGMENT_init_##ns##_, uid)(
torch::Library&); \
static const
torch::detail::TorchLibraryInitC10_CONCATENATE( \
TORCH_LIBRARY_FRAGMENT_static_init_##ns##_, uid)( \
torch::Library::FRAGMENT, \
&C10_CONCATENATE(TORCH_LIBRARY_FRAGMENT_init_##ns##_, uid), \
#ns, \
std::nullopt, \
__FILE__, \
__LINE__); \
void C10_CONCATENATE( \
TORCH_LIBRARY_FRAGMENT_init_##ns##_, uid)(
torch::Library & m)# The above macro requires an extra unique identifier (uid) to prevent variable name collisions This can happen if TORCH_LIBRARY_FRAGMENT is called multiple times with the same namespace in the same translation unit.
Note that the TORCH_LIBRARY variant doesn’t run into this problem, because it enforces that it can only be called once for a given namespace.