6 static PyMethodDef TorchDlMethods[] = {
10 #if PY_MAJOR_VERSION != 2 11 static struct PyModuleDef torchdlmodule = {
12 PyModuleDef_HEAD_INIT,
20 #if PY_MAJOR_VERSION == 2 21 PyMODINIT_FUNC init_dl(
void)
23 PyMODINIT_FUNC PyInit__dl(
void)
27 #if PY_MAJOR_VERSION == 2 28 #define ASSERT_TRUE(cmd) if (!(cmd)) {PyErr_SetString(PyExc_ImportError, "initialization error"); return;} 30 #define ASSERT_TRUE(cmd) if (!(cmd)) return NULL 33 #if PY_MAJOR_VERSION == 2 34 ASSERT_TRUE(module = Py_InitModule(
"torch._dl", TorchDlMethods));
36 ASSERT_TRUE(module = PyModule_Create(&torchdlmodule));
38 ASSERT_TRUE(PyModule_AddIntConstant(module,
"RTLD_GLOBAL", (int64_t) RTLD_GLOBAL) == 0);
39 ASSERT_TRUE(PyModule_AddIntConstant(module,
"RTLD_NOW", (int64_t) RTLD_NOW) == 0);
40 ASSERT_TRUE(PyModule_AddIntConstant(module,
"RTLD_LAZY", (int64_t) RTLD_LAZY) == 0);
42 #if PY_MAJOR_VERSION == 2