Rate this Page

Define _TORCH_LIBRARY_IMPL#

Define Documentation#

_TORCH_LIBRARY_IMPL(ns, k, m, uid)

static void C10_CONCATENATE(                                            \

TORCH_LIBRARY_IMPL_init_##ns##_##k##_, uid)(

torch::Library

&);       \

static const

torch::detail::TorchLibraryInit

C10_CONCATENATE(           \

TORCH_LIBRARY_IMPL_static_init_##ns##_##k##_, uid)(                 \

torch::Library::IMPL,                                               \

&C10_CONCATENATE(TORCH_LIBRARY_IMPL_init_##ns##_##k##_, uid),       \

#ns,                                                                \

std::make_optional(c10::DispatchKey::k),                            \

__FILE__,                                                           \

__LINE__);                                                          \

void C10_CONCATENATE(                                                   \

TORCH_LIBRARY_IMPL_init_##ns##_##k##_, uid)(

torch::Library & m)#

The above macro requires an extra unique identifier (uid) to prevent variable name collisions.

This can happen if TORCH_LIBRARY_IMPL is called multiple times with the same namespace and dispatch key in the same translation unit.