Caffe2 - C++ API
A deep learning, cross platform ML framework
nn_tail.cpp
1 namespace torch { namespace nn {
2 
3 static PyTypeObject thnn_type;
4 
5 void init_$short_name(PyObject* c_module) {
6  ((PyObject*)&thnn_type)->ob_refcnt = 1;
7  thnn_type.tp_flags = Py_TPFLAGS_DEFAULT;
8  thnn_type.tp_methods = module_methods;
9  thnn_type.tp_name = "torch._C.$short_name";
10  if (PyType_Ready(&thnn_type) < 0) {
11  throw python_error();
12  }
13 
14  PyObject* type_obj = (PyObject*)&thnn_type;
15  Py_INCREF(type_obj);
16  if (PyModule_AddObject(c_module, "$short_name", type_obj) < 0) {
17  throw python_error();
18  }
19 }
20 
21 }} // namespace torch::nn
Definition: jit_type.h:17