| 462 | PyTypeObject PyOpBase::py_type; |
| 463 | |
| 464 | void _init_py_op_base(py::module m) { |
| 465 | using py_op = PyOpBase; |
| 466 | auto& py_type = PyOpBase::py_type; |
| 467 | py_type = {PyVarObject_HEAD_INIT(NULL, 0)}; |
| 468 | py_type.tp_name = "megengine.core._imperative_rt.ops.PyOpBase"; |
| 469 | py_type.tp_basicsize = sizeof(py_op); |
| 470 | py_type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; |
| 471 | py_type.tp_doc = "PyOpBase"; |
| 472 | py_type.tp_base = &PyOpType(OpDef); |
| 473 | py_type.tp_dealloc = py_dealloc_generic<py_op>; |
| 474 | py_type.tp_new = py_op::tp_new; |
| 475 | mgb_assert(PyType_Ready(&py_type) >= 0); |
| 476 | m.add_object("PyOpBase", reinterpret_cast<PyObject*>(&py_type)); |
| 477 | } |
| 478 | |
| 479 | /*********** end of hand-write opdefs **************/ |
| 480 | |